Bug 1460874 - Part 7: Automatically attach GeckoFontScaleListener through GeckoRuntime. r=geckoview-reviewers,snorp
☠☠ backed out by cd616c3e3eea ☠ ☠
authorJan Henning <jh+bugzilla@buttercookie.de>
Wed, 13 Feb 2019 20:10:36 +0000
changeset 458949 1026b786e779
parent 458948 78f59df737fc
child 458950 17fbff3da236
push id35552
push usershindli@mozilla.com
push dateThu, 14 Feb 2019 04:39:44 +0000
treeherdermozilla-central@c6829642e2d0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgeckoview-reviewers, snorp
bugs1460874
milestone67.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 1460874 - Part 7: Automatically attach GeckoFontScaleListener through GeckoRuntime. r=geckoview-reviewers,snorp Differential Revision: https://phabricator.services.mozilla.com/D17747
mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoFontScaleListener.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntime.java
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
@@ -226,17 +226,16 @@ public class GeckoApplication extends Ap
 
         mInBackground = false;
     }
 
     private void initFontScaleListener() {
         final SharedPreferences prefs = GeckoSharedPrefs.forApp(this);
         prefs.registerOnSharedPreferenceChangeListener(this);
         onSharedPreferenceChanged(prefs, GeckoPreferences.PREFS_SYSTEM_FONT_SIZE);
-        GeckoFontScaleListener.getInstance().attachToContext(this);
     }
 
     private static GeckoRuntime sGeckoRuntime;
     public static GeckoRuntime getRuntime() {
         return sGeckoRuntime;
     }
 
     public static GeckoRuntime ensureRuntime(@NonNull Context context) {
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoFontScaleListener.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoFontScaleListener.java
@@ -17,17 +17,17 @@ import android.support.annotation.UiThre
 import android.util.Log;
 
 /**
  * A class that automatically adjusts font size and font inflation settings for web content in Gecko
  * in accordance with the device's OS font scale setting.
  *
  * @see android.provider.Settings.System#FONT_SCALE
  */
-/* package */ final class GeckoFontScaleListener
+public final class GeckoFontScaleListener
         extends ContentObserver {
     private static final String LOGTAG = "GeckoFontScaleListener";
 
     private static final String PREF_SYSTEM_FONT_SCALE = "font.size.systemFontScale";
     private static final String PREF_FONT_INFLATION = "font.size.inflation.minTwips";
     private static final int FONT_INFLATION_OFF = 0;
     private static final int FONT_INFLATION_ON_DEFAULT_VALUE = 120;
     private static final float DEFAULT_FONT_SCALE = 1.0f;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntime.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntime.java
@@ -20,16 +20,17 @@ import android.support.annotation.AnyThr
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 import android.support.annotation.UiThread;
 import android.text.TextUtils;
 import android.util.Log;
 
 import org.mozilla.gecko.EventDispatcher;
 import org.mozilla.gecko.GeckoAppShell;
+import org.mozilla.gecko.GeckoFontScaleListener;
 import org.mozilla.gecko.GeckoSystemStateListener;
 import org.mozilla.gecko.GeckoScreenOrientation;
 import org.mozilla.gecko.GeckoThread;
 import org.mozilla.gecko.PrefsHelper;
 import org.mozilla.gecko.util.BundleEventListener;
 import org.mozilla.gecko.util.EventCallback;
 import org.mozilla.gecko.util.GeckoBundle;
 import org.mozilla.gecko.util.StringUtils;
@@ -207,16 +208,17 @@ public final class GeckoRuntime implemen
             }
         }
 
         GeckoAppShell.useMaxScreenDepth(settings.getUseMaxScreenDepth());
         GeckoAppShell.setDisplayDensityOverride(settings.getDisplayDensityOverride());
         GeckoAppShell.setDisplayDpiOverride(settings.getDisplayDpiOverride());
         GeckoAppShell.setScreenSizeOverride(settings.getScreenSizeOverride());
         GeckoAppShell.setCrashHandlerService(settings.getCrashHandler());
+        GeckoFontScaleListener.getInstance().attachToContext(context);
 
         final GeckoThread.InitInfo info = new GeckoThread.InitInfo();
         info.args = settings.getArguments();
         info.extras = settings.getExtras();
         info.flags = flags;
         info.prefs = settings.getPrefsMap();
 
         if (!GeckoThread.init(info)) {