jenkins-bot has submitted this change and it was merged.

Change subject: Fix possible crash on Samsung devices.

Fix possible crash on Samsung devices.

On Samsung devices with API 23+, the floating ActionMode can cause a crash
when exiting an activity while the ActionMode is active (the system seems
to be attempting to attach the same ActionMode to the new activity).
(This is now our most prevalent crash in production, not counting the one
that was fixed earlier.)

This patch explicitly closes any ActionMode when pausing PageActivity.

As a bonus, this also seems to fix a potential leak of a Window object on
other (non-Samsung) devices when exiting the activity with an active
floating ActionMode.

Bug: T147191
Change-Id: I8cf8f803aec81cfe77612f81b683d4e55c5442ef
M app/src/main/java/org/wikipedia/page/
1 file changed, 5 insertions(+), 1 deletion(-)

  Mholloway: Looks good to me, approved
  jenkins-bot: Verified

diff --git a/app/src/main/java/org/wikipedia/page/ 
index f702af3..b5685cb 100644
--- a/app/src/main/java/org/wikipedia/page/
+++ b/app/src/main/java/org/wikipedia/page/
@@ -779,9 +779,13 @@
     public void onPause() {
-        super.onPause();
+        if (isCabOpen()) {
+            // Explicitly close any current ActionMode (see T147191)
+            finishActionMode();
+        }
         isZeroEnabled = app.getWikipediaZeroHandler().isZeroEnabled();
         currentZeroConfig = app.getWikipediaZeroHandler().getZeroConfig();
+        super.onPause();

To view, visit
To unsubscribe, visit

Gerrit-MessageType: merged
Gerrit-Change-Id: I8cf8f803aec81cfe77612f81b683d4e55c5442ef
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <>
Gerrit-Reviewer: BearND <>
Gerrit-Reviewer: Brion VIBBER <>
Gerrit-Reviewer: Dbrant <>
Gerrit-Reviewer: Mholloway <>
Gerrit-Reviewer: Niedzielski <>
Gerrit-Reviewer: jenkins-bot <>

MediaWiki-commits mailing list

Reply via email to