Bug 1480091 - Don't hide the status bar when exiting PIP mode; r=jchen
authorPetru Lingurar <petru.lingurar@softvision.ro>
Thu, 30 Aug 2018 17:49:29 +0000
changeset 482616 ee3ad446328d649e05b06c51122709340552bd6e
parent 482615 7a65516025af8c61f0629e208fd68240dde8f010
child 482617 e67f28fac303774e424dee53737744f3fb2bf77e
push id232
push userfmarier@mozilla.com
push dateWed, 05 Sep 2018 20:45:54 +0000
reviewersjchen
bugs1480091
milestone63.0a1
Bug 1480091 - Don't hide the status bar when exiting PIP mode; r=jchen From the PIP window the user can either return to the fullscreen app or exit it entirely. Fullscreen and subsequently hiding the status bar should only be done if the user is returning to the app. Differential Revision: https://phabricator.services.mozilla.com/D4676
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -1069,21 +1069,27 @@ public class BrowserApp extends GeckoApp
             mPipController.cleanResources();
 
             // User clicked a new link to be opened in Firefox.
             // We returned from Picture-in-picture mode and now must try to open that link.
             if (startingIntentAfterPip != null) {
                 getApplication().startActivity(startingIntentAfterPip);
                 startingIntentAfterPip = null;
             } else {
+                // Get if the user pressed in the PIP window to return to full app or closed it entirely
+                // by checking if the activity received onStop() or not.
+                final boolean userReturnedToFullApp = !isApplicationInBackground();
+
                 // After returning from Picture-in-picture mode the video will still be playing
                 // in fullscreen. But now we have the status bar showing.
                 // Call setFullscreen(..) to hide it and offer the same fullscreen video experience
                 // that the user had before entering in Picture-in-picture mode.
-                ActivityUtils.setFullScreen(this, true);
+                if (userReturnedToFullApp) {
+                    ActivityUtils.setFullScreen(this, true);
+                }
             }
         }
     }
 
     @Override
     public void onRestart() {
         super.onRestart();
         if (mIsAbortingAppLaunch) {