Bug 1019981 - Part 2: disable locale switching on API level 11 and 12. r=nalexander
authorRichard Newman <rnewman@mozilla.com>
Wed, 04 Jun 2014 19:21:33 -0700
changeset 207098 d8174c0580e5eec81f17bcede4557c2cfd87fcd0
parent 207097 a5088ee3f9211611b2f87197e6e18d71a5b86720
child 207099 a838c50bc2d15c423db716c9cb4da8325f36d1fa
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1019981
milestone32.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 1019981 - Part 2: disable locale switching on API level 11 and 12. r=nalexander
mobile/android/base/preferences/GeckoPreferences.java
--- a/mobile/android/base/preferences/GeckoPreferences.java
+++ b/mobile/android/base/preferences/GeckoPreferences.java
@@ -265,16 +265,17 @@ OnSharedPreferenceChangeListener
     }
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         // Apply the current user-selected locale, if necessary.
         checkLocale();
 
         // Track this so we can decide whether to show locale options.
+        // See also the workaround below for Bug 1015209.
         localeSwitchingIsEnabled = BrowserLocaleManager.getInstance().isEnabled();
 
         // For Android v11+ where we use Fragments (v11+ only due to bug 866352),
         // check that PreferenceActivity.EXTRA_SHOW_FRAGMENT has been set
         // (or set it) before super.onCreate() is called so Android can display
         // the correct Fragment resource.
 
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
@@ -282,20 +283,27 @@ OnSharedPreferenceChangeListener
                 // Set up the default fragment if there is no explicit fragment to show.
                 setupTopLevelFragmentIntent();
 
                 // This is the default header, because it's the first one.
                 // I know, this is an affront to all human decency. And yet.
                 updateTitle(getString(R.string.pref_header_customize));
             }
 
-            // So that Android doesn't put the fragment title (or nothing at
-            // all) in the action bar.
             if (onIsMultiPane()) {
+                // So that Android doesn't put the fragment title (or nothing at
+                // all) in the action bar.
                 updateActionBarTitle(R.string.settings_title);
+
+                if (Build.VERSION.SDK_INT < 13) {
+                    // Affected by Bug 1015209 -- no detach/attach.
+                    // If we try rejigging fragments, we'll crash, so don't
+                    // enable locale switching at all.
+                    localeSwitchingIsEnabled = false;
+                }
             }
         }
 
         super.onCreate(savedInstanceState);
 
         // Use setResourceToOpen to specify these extras.
         Bundle intentExtras = getIntent().getExtras();