Bug 1460874 - Part 1: Cleanups. r=geckoview-reviewers,snorp
☠☠ backed out by cd616c3e3eea ☠ ☠
authorJan Henning <jh+bugzilla@buttercookie.de>
Wed, 13 Feb 2019 20:09:58 +0000
changeset 458943 2d5e902b5b88
parent 458942 00df850ac3cf
child 458944 d42e39761eb8
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
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 1: Cleanups. r=geckoview-reviewers,snorp The GeckoFontScaleListener is intended to live as long as the app (and there- fore Gecko) remains alive and consequently keeps a reference to the *application* context, so the linter warning can be safely suppressed. Also reorder imports to match coding style. Differential Revision: https://phabricator.services.mozilla.com/D17743
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoFontScaleListener.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoFontScaleListener.java
@@ -1,37 +1,40 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 package org.mozilla.gecko;
+import org.mozilla.gecko.preferences.GeckoPreferences;
+import android.annotation.SuppressLint;
 import android.content.ContentResolver;
 import android.content.Context;
+import android.content.SharedPreferences;
 import android.database.ContentObserver;
-import android.content.SharedPreferences;
 import android.net.Uri;
 import android.provider.Settings;
 import android.support.annotation.UiThread;
 import android.util.Log;
-import org.mozilla.gecko.preferences.GeckoPreferences;
 class GeckoFontScaleListener
         extends ContentObserver
         implements SharedPreferences.OnSharedPreferenceChangeListener {
     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;
+    // We're referencing the *application* context, so this is in fact okay.
+    @SuppressLint("StaticFieldLeak")
     private static final GeckoFontScaleListener listenerInstance = new GeckoFontScaleListener();
     private Context applicationContext;
     private boolean initialized;
     private boolean running;
     public static GeckoFontScaleListener getInstance() {
         return listenerInstance;