From 4d33ca0eeb679180038d54fef9d27dfe63986fa4 Mon Sep 17 00:00:00 2001 From: Nick Rosbrook Date: Tue, 7 Jul 2015 11:55:18 -0700 Subject: [PATCH] Bug 1156546 - Remove "Developer Tools" preference category when in Guest Mode. r=liuche --HG-- extra : commitid : 8AwHKacUBzG extra : rebase_source : 84ff40f12d05a171a6a95fc76cb693469cdbd772 --- mobile/android/base/preferences/GeckoPreferences.java | 9 +++++++++ mobile/android/base/resources/xml-v11/preferences.xml | 3 ++- mobile/android/base/resources/xml/preferences.xml | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/mobile/android/base/preferences/GeckoPreferences.java b/mobile/android/base/preferences/GeckoPreferences.java index ab23c1ccfc15..7c8578fd711a 100644 --- a/mobile/android/base/preferences/GeckoPreferences.java +++ b/mobile/android/base/preferences/GeckoPreferences.java @@ -127,9 +127,11 @@ OnSharedPreferenceChangeListener public static final String PREFS_OPEN_URLS_IN_PRIVATE = NON_PREF_PREFIX + "openExternalURLsPrivately"; 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_DEVTOOLS = NON_PREF_PREFIX + "devtools.enabled"; private static final String ACTION_STUMBLER_UPLOAD_PREF = AppConstants.ANDROID_PACKAGE_NAME + ".STUMBLER_PREF"; + // This isn't a Gecko pref, even if it looks like one. private static final String PREFS_BROWSER_LOCALE = "locale"; @@ -692,6 +694,13 @@ OnSharedPreferenceChangeListener continue; } } + if (PREFS_DEVTOOLS.equals(key) && + RestrictedProfiles.isUserRestricted()) { + preferences.removePreference(pref); + i--; + continue; + } + setupPreferences((PreferenceGroup) pref, prefs); } else { pref.setOnPreferenceChangeListener(this); diff --git a/mobile/android/base/resources/xml-v11/preferences.xml b/mobile/android/base/resources/xml-v11/preferences.xml index 8a538df75752..4cfde7172905 100644 --- a/mobile/android/base/resources/xml-v11/preferences.xml +++ b/mobile/android/base/resources/xml-v11/preferences.xml @@ -55,7 +55,8 @@ + android:fragment="org.mozilla.gecko.preferences.GeckoPreferenceFragment" + android:key="android.not_a_preference.devtools.enabled" > diff --git a/mobile/android/base/resources/xml/preferences.xml b/mobile/android/base/resources/xml/preferences.xml index 453b1f0d78e3..bc6ab806558c 100644 --- a/mobile/android/base/resources/xml/preferences.xml +++ b/mobile/android/base/resources/xml/preferences.xml @@ -72,7 +72,8 @@ + android:summary="@string/pref_developer_remotedebugging" + android:key="android.not_a_preference.devtools.enabled" >