Bug 877725 - Provide user visible opt in UI for cell tower and wifi data collection and reporting. r=wesj

This commit is contained in:
Chenxia Liu 2013-06-20 12:11:26 -07:00
parent 6c78c365af
commit 396a5fdc24
6 changed files with 43 additions and 4 deletions

View File

@ -70,6 +70,7 @@ public class GeckoPreferences
private static String PREFS_MENU_CHAR_ENCODING = "browser.menu.showCharacterEncoding";
private static String PREFS_MP_ENABLED = "privacy.masterpassword.enabled";
private static String PREFS_UPDATER_AUTODOWNLOAD = "app.update.autodownload";
private static String PREFS_GEO_REPORTING = "app.geo.reportdata";
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -397,6 +398,10 @@ public class GeckoPreferences
// repeated background upload attempts.
broadcastHealthReportUploadPref(GeckoAppShell.getContext(), ((Boolean) newValue).booleanValue());
return true;
} else if (PREFS_GEO_REPORTING.equals(prefName)) {
// Translate boolean value to int for geo reporting pref.
PrefsHelper.setPref(prefName, (Boolean) newValue ? 1 : 0);
return true;
}
if (!TextUtils.isEmpty(prefName)) {
@ -651,6 +656,27 @@ public class GeckoPreferences
}
}
@Override
public void prefValue(String prefName, final int value) {
final Preference pref = getField(prefName);
final CheckBoxPrefSetter prefSetter;
if (PREFS_GEO_REPORTING.equals(prefName)) {
if (Build.VERSION.SDK_INT < 14) {
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
public boolean isObserver() {
return true;

View File

@ -154,6 +154,8 @@ size. -->
<!-- Localization note (datareporting_crashreporter_title_short) : This string matches
(crashReporterSection.label) in en-US/chrome/browser/preferences/advanced.dtd.-->
<!ENTITY datareporting_crashreporter_title_short "Crash Reporter">
<!ENTITY datareporting_wifi_title "&vendorShortName; location services">
<!ENTITY datareporting_wifi_summary "Help improve geolocation services for the Open Web by letting &brandShortName; collect and send anonymous cellular tower data">
<!ENTITY pref_update_autodownload "Automatic updates">
<!ENTITY pref_update_autodownload_wifi "Only over Wi-Fi">

View File

@ -23,4 +23,8 @@
android:summary="@string/datareporting_crashreporter_summary"
android:defaultValue="false" />
<CheckBoxPreference android:key="app.geo.reportdata"
android:title="@string/datareporting_wifi_title"
android:summary="@string/datareporting_wifi_summary" />
</PreferenceScreen>

View File

@ -147,6 +147,8 @@
<string name="datareporting_fhr_summary">&datareporting_fhr_summary;</string>
<string name="datareporting_crashreporter_title_short">&datareporting_crashreporter_title_short;</string>
<string name="datareporting_crashreporter_summary">&datareporting_crashreporter_summary;</string>
<string name="datareporting_wifi_title">&datareporting_wifi_title;</string>
<string name="datareporting_wifi_summary">&datareporting_wifi_summary;</string>
<string name="go">&go;</string>
<string name="search">&search;</string>

View File

@ -1078,11 +1078,13 @@ var BrowserApp = {
continue;
}
// Some preferences use integers or strings instead of booleans for
// indicating enabled/disabled. Since the Java UI uses the type to
// determine which ui elements to show, we need to normalize these
// preferences to be actual booleans.
// Some Gecko preferences use integers or strings to reference
// state instead of directly representing the value.
// Since the Java UI uses the type to determine which ui elements
// to show and how to handle them, we need to normalize these
// preferences to the correct type.
switch (prefName) {
// (string) index for determining which multiple choice value to display.
case "browser.chrome.titlebarMode":
case "network.cookie.cookieBehavior":
case "font.size.inflation.minTwips":

View File

@ -66,5 +66,8 @@ MOZ_PAY=1
# Enable UI for healthreporter
MOZ_SERVICES_HEALTHREPORT=1
# Wifi-AP/cell tower data reporting is always enabled.
MOZ_DATA_REPORTING=1
# Enable the production cert for verifying signed packaged apps.
MOZ_B2G_CERTDATA=1