зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1038843 - Part 2: Enable stumbler based on existing 'app.geo.reportdata' Gecko pref. r=nalexander
This commit is contained in:
Родитель
abbc2d7245
Коммит
9914f6f5b4
|
@ -94,6 +94,14 @@ public class AppConstants {
|
|||
// add additional quotes we end up with ""x.y"", which is a syntax error.
|
||||
public static final String MOZILLA_VERSION = @MOZILLA_VERSION@;
|
||||
|
||||
public static final String MOZ_STUMBLER_API_KEY =
|
||||
#ifdef MOZ_ANDROID_MLS_STUMBLER
|
||||
"@MOZ_STUMBLER_API_KEY@";
|
||||
#else
|
||||
null;
|
||||
#endif
|
||||
public static final boolean MOZ_STUMBLER_BUILD_TIME_ENABLED = (MOZ_STUMBLER_API_KEY != null);
|
||||
|
||||
public static final String MOZ_CHILD_PROCESS_NAME = "@MOZ_CHILD_PROCESS_NAME@";
|
||||
public static final String MOZ_UPDATE_CHANNEL = "@MOZ_UPDATE_CHANNEL@";
|
||||
public static final String OMNIJAR_NAME = "@OMNIJAR_NAME@";
|
||||
|
|
|
@ -669,6 +669,10 @@ public class BrowserApp extends GeckoApp
|
|||
super.onResume();
|
||||
EventDispatcher.getInstance().unregisterGeckoThreadListener((GeckoEventListener)this,
|
||||
"Prompt:ShowTop");
|
||||
if (AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED) {
|
||||
// Starts or pings the stumbler lib, see also usage in handleMessage(): Gecko:DelayedStartup.
|
||||
GeckoPreferences.broadcastStumblerPref(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1418,6 +1422,11 @@ public class BrowserApp extends GeckoApp
|
|||
}
|
||||
});
|
||||
|
||||
if (AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED) {
|
||||
// Start (this acts as ping if started already) the stumbler lib; if the stumbler has queued data it will upload it.
|
||||
// Stumbler operates on its own thread, and startup impact is further minimized by delaying work (such as upload) a few seconds.
|
||||
GeckoPreferences.broadcastStumblerPref(this);
|
||||
}
|
||||
super.handleMessage(event, message);
|
||||
} else if (event.equals("Gecko:Ready")) {
|
||||
// Handle this message in GeckoApp, but also enable the Settings
|
||||
|
|
|
@ -783,6 +783,7 @@ if CONFIG['MOZ_CRASHREPORTER']:
|
|||
if CONFIG['MOZ_ANDROID_MLS_STUMBLER']:
|
||||
main.included_projects += ['../FennecStumbler']
|
||||
main.referenced_projects += ['../FennecStumbler']
|
||||
DEFINES['MOZ_STUMBLER_API_KEY'] = CONFIG['MOZ_MOZILLA_API_KEY']
|
||||
|
||||
if CONFIG['MOZ_ANDROID_SEARCH_ACTIVITY']:
|
||||
searchres = add_android_eclipse_library_project('FennecResourcesSearch')
|
||||
|
|
|
@ -115,6 +115,7 @@ OnSharedPreferenceChangeListener
|
|||
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_SYNC = NON_PREF_PREFIX + "sync";
|
||||
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";
|
||||
|
@ -849,6 +850,34 @@ OnSharedPreferenceChangeListener
|
|||
broadcastAction(context, intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcast the provided value as the value of the
|
||||
* <code>PREFS_STUMBLER_ENABLED</code> pref.
|
||||
*/
|
||||
public static void broadcastStumblerPref(final Context context, final boolean value) {
|
||||
Intent intent = new Intent(PREFS_STUMBLER_ENABLED)
|
||||
.putExtra("pref", PREFS_GEO_REPORTING)
|
||||
.putExtra("branch", GeckoSharedPrefs.APP_PREFS_NAME)
|
||||
.putExtra("enabled", value)
|
||||
.putExtra("moz_mozilla_api_key", AppConstants.MOZ_STUMBLER_API_KEY);
|
||||
if (GeckoAppShell.getGeckoInterface() != null) {
|
||||
intent.putExtra("user_agent", GeckoAppShell.getGeckoInterface().getDefaultUAString());
|
||||
}
|
||||
if (!AppConstants.MOZILLA_OFFICIAL) {
|
||||
intent.putExtra("is_debug", true);
|
||||
}
|
||||
broadcastAction(context, intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcast the current value of the
|
||||
* <code>PREFS_STUMBLER_ENABLED</code> pref.
|
||||
*/
|
||||
public static void broadcastStumblerPref(final Context context) {
|
||||
final boolean value = getBooleanPref(context, PREFS_GEO_REPORTING, true);
|
||||
broadcastStumblerPref(context, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of the named preference in the default preferences file.
|
||||
*
|
||||
|
@ -1009,6 +1038,7 @@ OnSharedPreferenceChangeListener
|
|||
// 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)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче