Bug 1484960 - Remove IllegalStateException throw on multiple calls to overrides in GeckoAppShell r=jchen
authorRandall Barker <rbarker@mozilla.com>
Tue, 21 Aug 2018 19:17:30 +0000
changeset 487773 8d09209d2ee1a7baa166dedf8425dcbdfd35cfaa
parent 487772 7e2003fdace0e0df5db6dc1e6e95d2b526884692
child 487774 dcedddab6d8947a557b3a9f1724a2a37a4f13b54
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen
bugs1484960
milestone63.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 1484960 - Remove IllegalStateException throw on multiple calls to overrides in GeckoAppShell r=jchen Differential Revision: https://phabricator.services.mozilla.com/D3911
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
@@ -981,39 +981,42 @@ public class GeckoAppShell
                 name, cookie, title, text, host, imageUrl, persistentData);
     }
 
     @WrapForJNI(calledFrom = "gecko")
     private static void closeNotification(String name) {
         getNotificationListener().closeNotification(name);
     }
 
-    public static synchronized void setDisplayDpiOverride(final Integer dpi) {
+    public static synchronized void setDisplayDpiOverride(@Nullable final Integer dpi) {
         if (dpi == null) {
             return;
         }
         if (sDensityDpi != 0) {
             Log.e(LOGTAG, "Tried to override screen DPI after it's already been set");
-            throw new IllegalStateException();
+            return;
         }
         sDensityDpi = dpi;
     }
 
     @WrapForJNI(calledFrom = "gecko")
     public static synchronized int getDpi() {
         if (sDensityDpi == 0) {
             sDensityDpi = getApplicationContext().getResources().getDisplayMetrics().densityDpi;
         }
         return sDensityDpi;
     }
 
-    public static synchronized void setDisplayDensityOverride(@Nullable Float density) {
+    public static synchronized void setDisplayDensityOverride(@Nullable final Float density) {
+        if (density == null) {
+            return;
+        }
         if (sDensity != null) {
             Log.e(LOGTAG, "Tried to override screen density after it's already been set");
-            throw new IllegalStateException();
+            return;
         }
         sDensity = density;
     }
 
     @WrapForJNI(calledFrom = "gecko")
     private static synchronized float getDensity() {
         if (sDensity == null) {
             sDensity =  new Float(getApplicationContext().getResources().getDisplayMetrics().density);