Bug 1369673 - remove flag localeSwitchingIsEnabled from GeckoPreferences r=nalexander
remove the flag from GeckoPreferences as it is always true
MozReview-Commit-ID: J5bJwnaRFDa
--- a/mobile/android/base/AppConstants.java.in
+++ b/mobile/android/base/AppConstants.java.in
@@ -199,23 +199,16 @@ public class AppConstants {
public static final boolean MOZ_DATA_REPORTING =
//#ifdef MOZ_DATA_REPORTING
true;
//#else
false;
//#endif
- public static final boolean MOZ_LOCALE_SWITCHER =
-//#ifdef MOZ_LOCALE_SWITCHER
- true;
-//#else
- false;
-//#endif
-
public static final boolean MOZ_UPDATER =
//#ifdef MOZ_UPDATER
true;
//#else
false;
//#endif
// Android Beam is only supported on API14+, so we don't even bother building
--- a/mobile/android/base/generate_build_config.py
+++ b/mobile/android/base/generate_build_config.py
@@ -48,17 +48,16 @@ def _defines():
'MOZ_ANDROID_MMA',
'MOZ_ANDROID_MOZILLA_ONLINE',
'MOZ_LEANPLUM_SDK_KEY',
'MOZ_LEANPLUM_SDK_CLIENTID',
'MOZ_ANDROID_SEARCH_ACTIVITY',
'MOZ_CRASHREPORTER',
'MOZ_DEBUG',
'MOZ_INSTALL_TRACKING',
- 'MOZ_LOCALE_SWITCHER',
'MOZ_NATIVE_DEVICES',
'MOZ_SWITCHBOARD'):
if CONFIG[var]:
DEFINES[var] = 1
for var in ('MOZ_ANDROID_GCM_SENDERID',
'MOZ_PKG_SPECIAL',
'MOZ_UPDATER'):
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserLocaleManager.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserLocaleManager.java
@@ -74,21 +74,16 @@ public class BrowserLocaleManager implem
localeManager = new BrowserLocaleManager();
if (instance.compareAndSet(null, localeManager)) {
return localeManager;
} else {
return instance.get();
}
}
- @Override
- public boolean isEnabled() {
- return AppConstants.MOZ_LOCALE_SWITCHER;
- }
-
/**
* Ensure that you call this early in your application startup,
* and with a context that's sufficiently long-lived (typically
* the application context).
*
* Calling multiple times is harmless.
*/
@Override
--- a/mobile/android/base/java/org/mozilla/gecko/LocaleManager.java
+++ b/mobile/android/base/java/org/mozilla/gecko/LocaleManager.java
@@ -14,20 +14,16 @@ import android.content.res.Resources;
* Implement this interface to provide Fennec's locale switching functionality.
*
* The LocaleManager is responsible for persisting and applying selected locales,
* and correcting configurations after Android has changed them.
*/
public interface LocaleManager {
void initialize(Context context);
- /**
- * @return true if locale switching is enabled.
- */
- boolean isEnabled();
Locale getCurrentLocale(Context context);
String getAndApplyPersistedLocale(Context context);
void correctLocale(Context context, Resources resources, Configuration newConfig);
void updateConfiguration(Context context, Locale locale);
String setSelectedLocale(Context context, String localeCode);
boolean systemLocaleDidChange();
void resetToSystemLocale(Context context);
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -209,17 +209,16 @@ public class GeckoPreferences
}
private SwitchPreference tabQueuePreference;
/**
* Track the last locale so we know whether to redisplay.
*/
private Locale lastLocale = Locale.getDefault();
- private boolean localeSwitchingIsEnabled;
private void startActivityForResultChoosingTransition(final Intent intent, final int requestCode) {
startActivityForResult(intent, requestCode);
if (NO_TRANSITIONS) {
overridePendingTransition(0, 0);
}
}
@@ -351,20 +350,16 @@ public class GeckoPreferences
onLocaleChanged(currentLocale);
}
@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.
// Note: this seems to only be required for non-multipane devices, multipane
// manages to automatically select the correct fragments.
if (!getIntent().hasExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT)) {
// Set up the default fragment if there is no explicit fragment to show.
@@ -658,27 +653,16 @@ public class GeckoPreferences
* @param prefs An ArrayList to fill with Gecko preferences that need to be
* initialized
* @return The integer id for the PrefsHelper.PrefHandlerBase listener added
* to monitor changes to Gecko prefs.
*/
private void setupPreferences(PreferenceGroup preferences, ArrayList<String> prefs) {
for (int i = 0; i < preferences.getPreferenceCount(); i++) {
final Preference pref = preferences.getPreference(i);
-
- // Eliminate locale switching if necessary.
- // This logic will need to be extended when
- // content language selection (Bug 881510) is implemented.
- if (!localeSwitchingIsEnabled &&
- "preferences_locale".equals(pref.getExtras().getString("resource"))) {
- preferences.removePreference(pref);
- i--;
- continue;
- }
-
String key = pref.getKey();
if (pref instanceof PreferenceGroup) {
// If datareporting is disabled, remove UI.
if (PREFS_DATA_REPORTING_PREFERENCES.equals(key)) {
if (!AppConstants.MOZ_DATA_REPORTING || !Restrictions.isAllowed(this, Restrictable.DATA_CHOICES)) {
preferences.removePreference(pref);
i--;
continue;
--- a/mobile/android/moz.configure
+++ b/mobile/android/moz.configure
@@ -3,20 +3,16 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
project_flag('MOZ_ANDROID_EXCLUDE_FONTS',
help='Whether to exclude font files from the build',
default=True)
-project_flag('MOZ_LOCALE_SWITCHER',
- help='Enable runtime locale switching',
- default=True)
-
project_flag('MOZ_ANDROID_GCM',
help='Enable GCM (Google Cloud Messaging) registration',
default=True,
set_for_old_configure=True)
option(env='MOZ_NATIVE_DEVICES',
help='Enable second screen support using native Android libraries.',
default=True)