Bug 1399014 - Allow 'enable tracking protection in normal browsing' for release and beta channel. r?maliu draft
authorNevin Chen <cnevinchen@gmail.com>
Thu, 14 Sep 2017 15:16:55 +0800
changeset 664903 0b0eb7afb0df3f2485ad343694cb52f5cc3abe6c
parent 664491 c15e2f280729b6503f9455cd4448ab2852eb5806
child 731586 ec64c8df77b82a4696f00b67dc6578d87473f68a
push id79855
push userbmo:cnevinchen@gmail.com
push dateThu, 14 Sep 2017 15:52:59 +0000
reviewersmaliu
bugs1399014
milestone57.0a1
Bug 1399014 - Allow 'enable tracking protection in normal browsing' for release and beta channel. r?maliu In Android, "privacy.trackingprotection.state" is not a "real" pref name, but it's used in the setting menu and browser.js. "privacy.trackingprotection.state" and "privacy.trackingprotection.pbmode.enabled"(deleted) in Android is init in Helper.getPrefs and passed to browser.js when changed. The real pref for tacking protection are two Gecko pref in browser.js. They are: "privacy.trackingprotection.pbmode.enabled" "privacy.trackingprotection.enabled" All prefs in Android are delegated to them. The Android setting UI simply reflects the single source of truth (Gecko pref). That's the reason why the two Android perfs use android:persistent="false" MozReview-Commit-ID: 5ehBhtNM2Tx
mobile/android/app/src/main/res/xml/preferences_privacy.xml
mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
mobile/android/base/locales/en-US/android_strings.dtd
mobile/android/base/strings.xml.in
--- a/mobile/android/app/src/main/res/xml/preferences_privacy.xml
+++ b/mobile/android/app/src/main/res/xml/preferences_privacy.xml
@@ -14,21 +14,16 @@
                       android:persistent="false" />
 
     <org.mozilla.gecko.preferences.AlignRightLinkPreference
             android:key="android.not_a_preference.donottrackheader.learn_more"
             android:title="@string/pref_learn_more"
             android:persistent="false"
             url="https://www.mozilla.org/firefox/dnt/" />
 
-    <CheckBoxPreference android:key="privacy.trackingprotection.pbmode.enabled"
-                        android:title="@string/pref_tracking_protection_title"
-                        android:summary="@string/pref_tracking_protection_summary"
-                        android:persistent="false" />
-
     <ListPreference android:key="privacy.trackingprotection.state"
                     android:title="@string/pref_tracking_protection_title"
                     android:entries="@array/pref_tracking_protection_entries"
                     android:entryValues="@array/pref_tracking_protection_values"
                     android:persistent="false" />
 
     <org.mozilla.gecko.preferences.AlignRightLinkPreference
             android:key="android.not_a_preference.trackingprotection.learn_more"
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -128,21 +128,18 @@ public class GeckoPreferences
     private static final String PREFS_UPDATER_AUTODOWNLOAD = "app.update.autodownload";
     private static final String PREFS_UPDATER_URL = "app.update.url.android";
     private static final String PREFS_GEO_REPORTING = NON_PREF_PREFIX + "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_USB_ENABLED = "devtools.remote.usb.enabled";
     private static final String PREFS_DEVTOOLS_REMOTE_WIFI_ENABLED = "devtools.remote.wifi.enabled";
     private static final String PREFS_DEVTOOLS_REMOTE_LINK = NON_PREF_PREFIX + "remote_debugging.link";
-    private static final String PREFS_TRACKING_PROTECTION = "privacy.trackingprotection.state";
-    private static final String PREFS_TRACKING_PROTECTION_PB = "privacy.trackingprotection.pbmode.enabled";
     public static final String PREFS_VOICE_INPUT_ENABLED = NON_PREF_PREFIX + "voice_input_enabled";
     public static final String PREFS_QRCODE_ENABLED = NON_PREF_PREFIX + "qrcode_enabled";
-    private static final String PREFS_TRACKING_PROTECTION_PRIVATE_BROWSING = "privacy.trackingprotection.pbmode.enabled";
     private static final String PREFS_TRACKING_PROTECTION_LEARN_MORE = NON_PREF_PREFIX + "trackingprotection.learn_more";
     private static final String PREFS_CLEAR_PRIVATE_DATA = NON_PREF_PREFIX + "privacy.clear";
     private static final String PREFS_CLEAR_PRIVATE_DATA_EXIT = NON_PREF_PREFIX + "history.clear_on_exit";
     private static final String PREFS_SCREEN_ADVANCED = NON_PREF_PREFIX + "advanced_screen";
     public static final String PREFS_HOMEPAGE = NON_PREF_PREFIX + "homepage";
     public static final String PREFS_HOMEPAGE_FOR_EVERY_NEW_TAB = NON_PREF_PREFIX + "newtab.load_homepage";
     public static final String PREFS_HOMEPAGE_PARTNER_COPY = GeckoPreferences.PREFS_HOMEPAGE + ".partner";
     public static final String PREFS_HISTORY_SAVED_SEARCH = NON_PREF_PREFIX + "search.search_history.enabled";
@@ -668,30 +665,16 @@ public class GeckoPreferences
 
                 pref.setOnPreferenceChangeListener(this);
                 if (PREFS_UPDATER_AUTODOWNLOAD.equals(key)) {
                     if (!AppConstants.MOZ_UPDATER || ContextUtils.isInstalledFromGooglePlay(this)) {
                         preferences.removePreference(pref);
                         i--;
                         continue;
                     }
-                } else if (PREFS_TRACKING_PROTECTION.equals(key)) {
-                    // Remove UI for global TP pref in non-Nightly builds.
-                    if (!AppConstants.NIGHTLY_BUILD) {
-                        preferences.removePreference(pref);
-                        i--;
-                        continue;
-                    }
-                } else if (PREFS_TRACKING_PROTECTION_PB.equals(key)) {
-                    // Remove UI for private-browsing-only TP pref in Nightly builds.
-                    if (AppConstants.NIGHTLY_BUILD) {
-                        preferences.removePreference(pref);
-                        i--;
-                        continue;
-                    }
                 } else if (PREFS_TELEMETRY_ENABLED.equals(key)) {
                     if (!AppConstants.MOZ_TELEMETRY_REPORTING || !Restrictions.isAllowed(this, Restrictable.DATA_CHOICES)) {
                         preferences.removePreference(pref);
                         i--;
                         continue;
                     }
                 } else if (PREFS_HEALTHREPORT_UPLOAD_ENABLED.equals(key) ||
                            PREFS_HEALTHREPORT_LINK.equals(key)) {
@@ -781,22 +764,16 @@ public class GeckoPreferences
                     }
                 } else if (PREFS_QRCODE_ENABLED.equals(key)) {
                     if (!InputOptionsUtils.supportsQrCodeReader(getApplicationContext())) {
                         // Remove UI for qr code input on non nightly builds
                         preferences.removePreference(pref);
                         i--;
                         continue;
                     }
-                } else if (PREFS_TRACKING_PROTECTION_PRIVATE_BROWSING.equals(key)) {
-                    if (!Restrictions.isAllowed(this, Restrictable.PRIVATE_BROWSING)) {
-                        preferences.removePreference(pref);
-                        i--;
-                        continue;
-                    }
                 } else if (PREFS_TRACKING_PROTECTION_LEARN_MORE.equals(key)) {
                     if (!Restrictions.isAllowed(this, Restrictable.PRIVATE_BROWSING)) {
                         preferences.removePreference(pref);
                         i--;
                         continue;
                     }
                 } else if (PREFS_MP_ENABLED.equals(key)) {
                     if (!Restrictions.isAllowed(this, Restrictable.MASTER_PASSWORD)) {
--- a/mobile/android/base/locales/en-US/android_strings.dtd
+++ b/mobile/android/base/locales/en-US/android_strings.dtd
@@ -266,17 +266,16 @@
 <!ENTITY pref_tap_to_load_images_enabled "Always">
 <!ENTITY pref_tap_to_load_images_data "Only over Wi-Fi">
 <!ENTITY pref_tap_to_load_images_disabled2 "Blocked">
 
 <!ENTITY pref_show_web_fonts "Show web fonts">
 <!ENTITY pref_show_web_fonts_summary2 "Download remote fonts when loading a page">
 
 <!ENTITY pref_tracking_protection_title2 "Tracking Protection">
-<!ENTITY pref_tracking_protection_summary3 "Enabled in Private Browsing">
 <!ENTITY pref_donottrack_title "Do not track">
 <!ENTITY pref_donottrack_summary "&brandShortName; will tell sites that you do not want to be tracked">
 
 <!ENTITY pref_tracking_protection_enabled "Enabled">
 <!ENTITY pref_tracking_protection_enabled_pb "Enabled in Private Browsing">
 <!ENTITY pref_tracking_protection_disabled "Disabled">
 
 <!ENTITY pref_whats_new_notification "What\'s new in &brandShortName;">
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -211,17 +211,16 @@
   <string name="pref_tap_to_load_images_enabled">&pref_tap_to_load_images_enabled;</string>
   <string name="pref_tap_to_load_images_data">&pref_tap_to_load_images_data;</string>
   <string name="pref_tap_to_load_images_disabled2">&pref_tap_to_load_images_disabled2;</string>
 
   <string name="pref_show_web_fonts">&pref_show_web_fonts;</string>
   <string name="pref_show_web_fonts_summary">&pref_show_web_fonts_summary2;</string>
 
   <string name="pref_tracking_protection_title">&pref_tracking_protection_title2;</string>
-  <string name="pref_tracking_protection_summary">&pref_tracking_protection_summary3;</string>
   <string name="pref_donottrack_title">&pref_donottrack_title;</string>
   <string name="pref_donottrack_summary">&pref_donottrack_summary;</string>
 
   <string name="pref_tracking_protection_enabled">&pref_tracking_protection_enabled;</string>
   <string name="pref_tracking_protection_enabled_pb">&pref_tracking_protection_enabled_pb;</string>
   <string name="pref_tracking_protection_disabled">&pref_tracking_protection_disabled;</string>
 
   <string name="pref_whats_new_notification">&pref_whats_new_notification;</string>