From 768b67701b41b06789057978db4a18838b85eda9 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 17 Sep 2014 21:47:20 -0400 Subject: [PATCH] Backed out 5 changesets (bug 1068388) for robocop failures. Backed out changeset 099d0ec27cd9 (bug 1068388) Backed out changeset 29d39909222d (bug 1068388) Backed out changeset e85caca8529f (bug 1068388) Backed out changeset cf6f1223b6b7 (bug 1068388) Backed out changeset 920b201d30e9 (bug 1068388) CLOSED TREE --- mobile/android/app/mobile.js | 1 + mobile/android/base/GeckoApp.java | 6 +++ .../base/preferences/GeckoPreferences.java | 46 ++++++++++++------- .../base/resources/xml/preferences_vendor.xml | 2 +- .../base/tests/testSettingsMenuItems.java | 10 ++-- 5 files changed, 42 insertions(+), 23 deletions(-) diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js index 201d5bb27255..b3bc57444934 100644 --- a/mobile/android/app/mobile.js +++ b/mobile/android/app/mobile.js @@ -402,6 +402,7 @@ pref("privacy.item.syncAccount", true); // enable geo pref("geo.enabled", true); +pref("app.geo.reportdata", 0); // content sink control -- controls responsiveness during page load // see https://bugzilla.mozilla.org/show_bug.cgi?id=481566#c9 diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index b6b6988a609d..a59a7053df0c 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -1563,6 +1563,12 @@ public abstract class GeckoApp } }); + PrefsHelper.getPref("app.geo.reportdata", new PrefsHelper.PrefHandlerBase() { + @Override public void prefValue(String pref, int value) { + // Acting on this pref is Bug 1036508; for now, do nothing. + } + }); + // Trigger the completion of the telemetry timer that wraps activity startup, // then grab the duration to give to FHR. mJavaUiStartupTimer.stop(); diff --git a/mobile/android/base/preferences/GeckoPreferences.java b/mobile/android/base/preferences/GeckoPreferences.java index f629e56e3e0d..75af9772264f 100644 --- a/mobile/android/base/preferences/GeckoPreferences.java +++ b/mobile/android/base/preferences/GeckoPreferences.java @@ -110,15 +110,14 @@ OnSharedPreferenceChangeListener private static final String PREFS_MENU_CHAR_ENCODING = "browser.menu.showCharacterEncoding"; private static final String PREFS_MP_ENABLED = "privacy.masterpassword.enabled"; private static final String PREFS_UPDATER_AUTODOWNLOAD = "app.update.autodownload"; - private static final String PREFS_GEO_REPORTING = NON_PREF_PREFIX + "app.geo.reportdata"; + private static final String PREFS_GEO_REPORTING = "app.geo.reportdata"; private static final String PREFS_GEO_LEARN_MORE = NON_PREF_PREFIX + "geo.learn_more"; private static final String PREFS_HEALTHREPORT_LINK = NON_PREF_PREFIX + "healthreport.link"; private static final String PREFS_DEVTOOLS_REMOTE_ENABLED = "devtools.debugger.remote-enabled"; private static final String PREFS_DISPLAY_REFLOW_ON_ZOOM = "browser.zoom.reflowOnZoom"; private static final String PREFS_DISPLAY_TITLEBAR_MODE = "browser.chrome.titlebarMode"; private static final String PREFS_SYNC = NON_PREF_PREFIX + "sync"; - - private static final String ACTION_STUMBLER_UPLOAD_PREF = AppConstants.ANDROID_PACKAGE_NAME + ".STUMBLER_PREF"; + private static final String PREFS_STUMBLER_ENABLED = AppConstants.ANDROID_PACKAGE_NAME + ".STUMBLER_PREF"; // This isn't a Gecko pref, even if it looks like one. private static final String PREFS_BROWSER_LOCALE = "locale"; @@ -684,9 +683,10 @@ OnSharedPreferenceChangeListener preferences.removePreference(pref); i--; continue; - } else if (!AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED && - (PREFS_GEO_REPORTING.equals(key) || - PREFS_GEO_LEARN_MORE.equals(key))) { + } else if (AppConstants.RELEASE_BUILD && + (PREFS_GEO_REPORTING.equals(key) || + PREFS_GEO_LEARN_MORE.equals(key))) { + // We don't build wifi/cell tower collection in release builds, so hide the UI. preferences.removePreference(pref); i--; continue; @@ -869,10 +869,10 @@ OnSharedPreferenceChangeListener /** * Broadcast the provided value as the value of the - * PREFS_GEO_REPORTING pref. + * PREFS_STUMBLER_ENABLED pref. */ public static void broadcastStumblerPref(final Context context, final boolean value) { - Intent intent = new Intent(ACTION_STUMBLER_UPLOAD_PREF) + Intent intent = new Intent(PREFS_STUMBLER_ENABLED) .putExtra("pref", PREFS_GEO_REPORTING) .putExtra("branch", GeckoSharedPrefs.APP_PREFS_NAME) .putExtra("enabled", value) @@ -888,7 +888,7 @@ OnSharedPreferenceChangeListener /** * Broadcast the current value of the - * PREFS_GEO_REPORTING pref. + * PREFS_STUMBLER_ENABLED pref. */ public static void broadcastStumblerPref(final Context context) { final boolean value = getBooleanPref(context, PREFS_GEO_REPORTING, false); @@ -1046,11 +1046,6 @@ OnSharedPreferenceChangeListener return onLocaleSelected(BrowserLocaleManager.getLanguageTag(lastLocale), (String) newValue); } - if (PREFS_GEO_REPORTING.equals(prefName)) { - broadcastStumblerPref(this, ((Boolean) newValue).booleanValue()); - return true; - } - if (PREFS_MENU_CHAR_ENCODING.equals(prefName)) { setCharEncodingState(((String) newValue).equals("true")); } else if (PREFS_UPDATER_AUTODOWNLOAD.equals(prefName)) { @@ -1061,12 +1056,16 @@ OnSharedPreferenceChangeListener // background uploader service, which will start or stop the // repeated background upload attempts. broadcastHealthReportUploadPref(this, ((Boolean) newValue).booleanValue()); + } else if (PREFS_GEO_REPORTING.equals(prefName)) { + broadcastStumblerPref(this, ((Boolean) newValue).booleanValue()); + // Translate boolean value to int for geo reporting pref. + newValue = ((Boolean) newValue) ? 1 : 0; } else if (handlers.containsKey(prefName)) { PrefHandler handler = handlers.get(prefName); handler.onChange(this, preference, newValue); } - // Send Gecko-side pref changes to Gecko. + // Send Gecko-side pref changes to Gecko if (isGeckoPref(prefName)) { PrefsHelper.setPref(prefName, newValue); } @@ -1322,7 +1321,22 @@ OnSharedPreferenceChangeListener @Override public void prefValue(String prefName, final int value) { final Preference pref = getField(prefName); - Log.w(LOGTAG, "Unhandled int value for pref [" + pref + "]"); + final CheckBoxPrefSetter prefSetter; + if (PREFS_GEO_REPORTING.equals(prefName)) { + if (Versions.preICS) { + prefSetter = new CheckBoxPrefSetter(); + } else { + prefSetter = new TwoStatePrefSetter(); + } + ThreadUtils.postToUiThread(new Runnable() { + @Override + public void run() { + prefSetter.setBooleanPref(pref, value == 1); + } + }); + } else { + Log.w(LOGTAG, "Unhandled int value for pref [" + pref + "]"); + } } @Override diff --git a/mobile/android/base/resources/xml/preferences_vendor.xml b/mobile/android/base/resources/xml/preferences_vendor.xml index 55294ef0a91f..c200de3e3f36 100644 --- a/mobile/android/base/resources/xml/preferences_vendor.xml +++ b/mobile/android/base/resources/xml/preferences_vendor.xml @@ -35,7 +35,7 @@ android:summary="@string/datareporting_crashreporter_summary" android:defaultValue="false" /> - diff --git a/mobile/android/base/tests/testSettingsMenuItems.java b/mobile/android/base/tests/testSettingsMenuItems.java index 76039799be5d..f83e1e670855 100644 --- a/mobile/android/base/tests/testSettingsMenuItems.java +++ b/mobile/android/base/tests/testSettingsMenuItems.java @@ -170,14 +170,12 @@ public class testSettingsMenuItems extends PixelTest { settingsMap.get(PATH_DISPLAY).remove(TITLE_BAR_LABEL_ARR); } - String[] learnMoreUi = { "Learn more" }; - settingsMap.get(PATH_MOZILLA).add(learnMoreUi); - } - - // Anonymous cell tower/wifi collection. - if (AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED) { + // Anonymous cell tower/wifi collection - only built if *not* release build String[] networkReportingUi = { "Mozilla Location Service", "Receives Wi-Fi and cellular location data when running in the background and shares it with Mozilla to improve our geolocation service" }; settingsMap.get(PATH_MOZILLA).add(networkReportingUi); + + String[] learnMoreUi = { "Learn more" }; + settingsMap.get(PATH_MOZILLA).add(learnMoreUi); } // Automatic updates