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

--HG--
extra : rebase_source : e5e1550d0d76fc21e36865489a3f3809f64468bf
This commit is contained in:
Jan Henning 2017-10-12 20:06:51 +02:00
Родитель 96cd7cfb3c
Коммит cb0745a3da
2 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -2136,6 +2136,8 @@ public abstract class GeckoApp extends GeckoActivity
} }
}); });
GeckoAppShell.setScreenOrientationDelegate(null);
super.onPause(); super.onPause();
} }

Просмотреть файл

@ -84,6 +84,7 @@ import android.os.SystemClock;
import android.os.Vibrator; import android.os.Vibrator;
import android.provider.Settings; import android.provider.Settings;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.util.SimpleArrayMap; import android.support.v4.util.SimpleArrayMap;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.text.TextUtils; import android.text.TextUtils;
@ -628,7 +629,7 @@ public class GeckoAppShell
return sScreenOrientationDelegate; return sScreenOrientationDelegate;
} }
public static void setScreenOrientationDelegate(ScreenOrientationDelegate screenOrientationDelegate) { public static void setScreenOrientationDelegate(@Nullable ScreenOrientationDelegate screenOrientationDelegate) {
sScreenOrientationDelegate = (screenOrientationDelegate != null) ? screenOrientationDelegate : DEFAULT_LISTENERS; sScreenOrientationDelegate = (screenOrientationDelegate != null) ? screenOrientationDelegate : DEFAULT_LISTENERS;
} }