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/PageActivity.java
1 file changed, 5 insertions(+), 1 deletion(-)

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



diff --git a/app/src/main/java/org/wikipedia/page/PageActivity.java 
b/app/src/main/java/org/wikipedia/page/PageActivity.java
index f702af3..b5685cb 100644
--- a/app/src/main/java/org/wikipedia/page/PageActivity.java
+++ b/app/src/main/java/org/wikipedia/page/PageActivity.java
@@ -779,9 +779,13 @@
 
     @Override
     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();
     }
 
     @Override

-- 
To view, visit https://gerrit.wikimedia.org/r/315288
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8cf8f803aec81cfe77612f81b683d4e55c5442ef
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <dbr...@wikimedia.org>
Gerrit-Reviewer: BearND <bsitzm...@wikimedia.org>
Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org>
Gerrit-Reviewer: Dbrant <dbr...@wikimedia.org>
Gerrit-Reviewer: Mholloway <mhollo...@wikimedia.org>
Gerrit-Reviewer: Niedzielski <sniedziel...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to