Bug 1407835 - Don't keep BrowserApp unnecessarily alive through sScreenOrientationDelegate. r=nalexander
authorJan Henning <jh+bugzilla@buttercookie.de>
Thu, 12 Oct 2017 20:06:51 +0200
changeset 386199 20c73eec1bd2e38e2b454101da8e8a1cf13f9d51
parent 386198 6fa6873c200c7e93ca82bf7847dcdff4ca58c18b
child 386200 a0f88980b79c4f5fdb982a1d8091141154c6eb16
push id32678
push userarchaeopteryx@coole-files.de
push dateSat, 14 Oct 2017 09:40:07 +0000
treeherdermozilla-central@0dd64d5842e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1407835
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1407835 - Don't keep BrowserApp unnecessarily alive through sScreenOrientationDelegate. r=nalexander We need to clear the reference again if BrowserApp is possibly going to be destroyed. At the moment there aren't any other activities using setScreenOrientationDelegate, but in preparation for that happening we unset BrowserApp as delegate already in onPause (instead of onDestroy) so we don't mistakenly assume that BrowserApp will remain the active ScreenOrientationDelegate all the time, even when it has been paused by some other activity. MozReview-Commit-ID: 9q0MSzi78Vm
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -2131,16 +2131,18 @@ public abstract class GeckoApp extends G
 
                     editor.putBoolean(GeckoApp.PREFS_CLEANUP_TEMP_FILES, false);
                 }
 
                 editor.apply();
             }
         });
 
+        GeckoAppShell.setScreenOrientationDelegate(null);
+
         super.onPause();
     }
 
     @Override
     public void onRestart() {
         if (mIsAbortingAppLaunch) {
             super.onRestart();
             return;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
@@ -79,16 +79,17 @@ import android.os.Bundle;
 import android.os.Environment;
 import android.os.Looper;
 import android.os.ParcelFileDescriptor;
 import android.os.PowerManager;
 import android.os.SystemClock;
 import android.os.Vibrator;
 import android.provider.Settings;
 import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
 import android.support.v4.util.SimpleArrayMap;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
 import android.util.DisplayMetrics;
 import android.util.Log;
 import android.view.ContextThemeWrapper;
 import android.view.Display;
 import android.view.HapticFeedbackConstants;
@@ -623,17 +624,17 @@ public class GeckoAppShell
     public static void setNotificationListener(final NotificationListener listener) {
         sNotificationListener = (listener != null) ? listener : DEFAULT_LISTENERS;
     }
 
     public static ScreenOrientationDelegate getScreenOrientationDelegate() {
         return sScreenOrientationDelegate;
     }
 
-    public static void setScreenOrientationDelegate(ScreenOrientationDelegate screenOrientationDelegate) {
+    public static void setScreenOrientationDelegate(@Nullable ScreenOrientationDelegate screenOrientationDelegate) {
         sScreenOrientationDelegate = (screenOrientationDelegate != null) ? screenOrientationDelegate : DEFAULT_LISTENERS;
     }
 
     public static WakeLockDelegate getWakeLockDelegate() {
         return sWakeLockDelegate;
     }
 
     public void setWakeLockDelegate(final WakeLockDelegate delegate) {