Bug 1427771 - Fix broken exitFullScreen() in GeckoSession and call it in onBackPressed in custom tabs and PWAs. r=snorp a=lizzard
authorDylan Roeh <droeh@mozilla.com>
Tue, 23 Jan 2018 16:18:15 -0600
changeset 454565 c68fbca720b4823dc12102f51323a1abc72af10b
parent 454564 d5435862b0cfd065c482f8d79ccb9c06e0f15669
child 454566 175697dceadf58159572722e2b5633d0e9a92f1f
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp, lizzard
bugs1427771
milestone59.0
Bug 1427771 - Fix broken exitFullScreen() in GeckoSession and call it in onBackPressed in custom tabs and PWAs. r=snorp a=lizzard
mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java
mobile/android/modules/geckoview/GeckoViewContent.jsm
--- a/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java
@@ -262,20 +262,23 @@ public class CustomTabsActivity extends 
             overridePendingTransition(IntentUtil.getEnterAnimationRes(intent),
                     IntentUtil.getExitAnimationRes(intent));
             usingCustomAnimation = false;
         }
     }
 
     @Override
     public void onBackPressed() {
-        if (mCanGoBack) {
+        final boolean fullScreen = ActivityUtils.isFullScreen(this);
+        if (fullScreen) {
+            mGeckoSession.exitFullScreen();
+        } else if (mCanGoBack) {
             mGeckoSession.goBack();
         } else {
-            finish();
+            super.onBackPressed();
         }
     }
 
     // Usually should use onCreateOptionsMenu() to initialize menu items. But GeckoApp overwrite
     // it to support custom menu(Bug 739412). Then the parameter *menu* in this.onCreateOptionsMenu()
     // and this.onPrepareOptionsMenu() are different instances - GeckoApp.onCreatePanelMenu() changed it.
     // CustomTabsActivity only use standard menu in ActionBar, so initialize menu here.
     @Override
--- a/mobile/android/modules/geckoview/GeckoViewContent.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewContent.jsm
@@ -48,16 +48,18 @@ class GeckoViewContent extends GeckoView
     this.messageManager.addMessageListener("GeckoView:DOMFullscreenRequest", this);
   }
 
   // Bundle event handler.
   onEvent(aEvent, aData, aCallback) {
     debug("onEvent: " + aEvent);
     switch (aEvent) {
       case "GeckoViewContent:ExitFullScreen":
+        this.messageManager.sendAsyncMessage("GeckoView:DOMFullscreenExited");
+        break;
       case "GeckoView:ZoomToInput":
         this.messageManager.sendAsyncMessage(aEvent);
         break;
       case "GeckoView:SetActive":
         this.browser.docShellIsActive = aData.active;
         break;
     }
   }