Bug 1547929 - [Tablet] Make default browser option not displayed on top of the Settings Menu; r=VladBaicu
☠☠ backed out by 5cd3bf5c4248 ☠ ☠
authordiana.iacos <diana.iacos@softvision.ro>
Thu, 02 May 2019 09:16:05 +0000
changeset 531064 0727a51d7ae175545ff5c772fc7547d4eff49404
parent 531063 4c6e2e3f23f9adc7c89e8c500a14ec9cd9f074bd
child 531065 fe9afae0f868666eec95b151b50d5c6783c3cd91
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersVladBaicu
bugs1547929
milestone68.0a1
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 1547929 - [Tablet] Make default browser option not displayed on top of the Settings Menu; r=VladBaicu Differential Revision: https://phabricator.services.mozilla.com/D29636
mobile/android/app/src/main/res/xml-v11/preference_headers.xml
mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
--- a/mobile/android/app/src/main/res/xml-v11/preference_headers.xml
+++ b/mobile/android/app/src/main/res/xml-v11/preference_headers.xml
@@ -12,16 +12,23 @@
     <header android:fragment="org.mozilla.gecko.preferences.GeckoPreferenceFragment"
             android:title="@string/pref_header_general"
             android:id="@+id/pref_header_general">
         <extra android:name="resource"
                android:value="preferences_general_tablet"/>
     </header>
 
     <header android:fragment="org.mozilla.gecko.preferences.GeckoPreferenceFragment"
+            android:title="@string/pref_default_browser"
+            android:id="@+id/pref_header_default_browser">
+        <extra android:name="resource"
+                android:value="preferences_default_browser_tablet"/>
+    </header>
+
+    <header android:fragment="org.mozilla.gecko.preferences.GeckoPreferenceFragment"
             android:title="@string/pref_header_search"
             android:id="@+id/pref_header_search">
         <extra android:name="resource"
                android:value="preferences_search"/>
     </header>
 
     <header android:fragment="org.mozilla.gecko.preferences.GeckoPreferenceFragment"
             android:title="@string/pref_header_privacy_short"
@@ -54,22 +61,15 @@
     <header android:fragment="org.mozilla.gecko.preferences.GeckoPreferenceFragment"
         android:title="@string/pref_clear_private_data_now"
         android:id="@+id/pref_header_clear_private_data">
         <extra android:name="resource"
             android:value="preferences_privacy_clear_tablet"/>
     </header>
 
     <header android:fragment="org.mozilla.gecko.preferences.GeckoPreferenceFragment"
-        android:title="@string/pref_default_browser"
-        android:id="@+id/pref_header_default_browser">
-        <extra android:name="resource"
-            android:value="preferences_default_browser_tablet"/>
-    </header>
-
-    <header android:fragment="org.mozilla.gecko.preferences.GeckoPreferenceFragment"
             android:title="@string/pref_header_vendor"
             android:id="@+id/pref_header_vendor">
         <extra android:name="resource"
                android:value="preferences_vendor"/>
     </header>
 
 </preference-headers>
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -462,16 +462,19 @@ public class GeckoPreferences
 
                 if (header.id == R.id.pref_header_advanced && !Restrictions.isAllowed(this, Restrictable.ADVANCED_SETTINGS)) {
                     iterator.remove();
                 } else if (header.id == R.id.pref_header_clear_private_data
                            && !Restrictions.isAllowed(this, Restrictable.CLEAR_HISTORY)) {
                     iterator.remove();
                 } else if (header.id == R.id.pref_header_notifications
                         && !haveNotificationsPreferences(this)) {
+                      iterator.remove();
+                } else if (header.id == R.id.pref_header_default_browser
+                        && PackageUtil.isDefaultBrowser(this)) {
                     iterator.remove();
                 }
             }
 
             mHeaders = target;
         }
     }
 
@@ -545,16 +548,19 @@ public class GeckoPreferences
         super.onResume();
 
         // Watch prefs, otherwise we don't reliably get told when they change.
         // See documentation for onSharedPreferenceChange for more.
         // Inexplicably only needed on tablet.
         if (isMultiPane()) {
             SharedPreferences prefs = GeckoSharedPrefs.forApp(this);
             prefs.registerOnSharedPreferenceChangeListener(this);
+            if (!PackageUtil.isDefaultBrowser(this)) {
+                invalidateHeaders();
+            }
         }
     }
 
     @Override
     public void startActivity(Intent intent) {
         // For settings, we want to be able to pass results up the chain
         // of preference screens so Settings can behave as a single unit.
         // Specifically, when we open a link, we want to back out of all