Bug 1156546 - Remove "Developer Tools" preference category when in Guest Mode. r=liuche

This commit is contained in:
Nick Rosbrook 2015-07-07 11:55:18 -07:00
parent 4dbb23b545
commit b83577f5d5
3 changed files with 13 additions and 2 deletions

View File

@ -127,9 +127,11 @@ OnSharedPreferenceChangeListener
public static final String PREFS_OPEN_URLS_IN_PRIVATE = NON_PREF_PREFIX + "openExternalURLsPrivately"; 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_VOICE_INPUT_ENABLED = NON_PREF_PREFIX + "voice_input_enabled";
public static final String PREFS_QRCODE_ENABLED = NON_PREF_PREFIX + "qrcode_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"; 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. // This isn't a Gecko pref, even if it looks like one.
private static final String PREFS_BROWSER_LOCALE = "locale"; private static final String PREFS_BROWSER_LOCALE = "locale";
@ -692,6 +694,13 @@ OnSharedPreferenceChangeListener
continue; continue;
} }
} }
if (PREFS_DEVTOOLS.equals(key) &&
RestrictedProfiles.isUserRestricted()) {
preferences.removePreference(pref);
i--;
continue;
}
setupPreferences((PreferenceGroup) pref, prefs); setupPreferences((PreferenceGroup) pref, prefs);
} else { } else {
pref.setOnPreferenceChangeListener(this); pref.setOnPreferenceChangeListener(this);

View File

@ -55,7 +55,8 @@
<PreferenceScreen android:title="@string/pref_category_devtools" <PreferenceScreen android:title="@string/pref_category_devtools"
android:summary="@string/pref_developer_remotedebugging" android:summary="@string/pref_developer_remotedebugging"
android:fragment="org.mozilla.gecko.preferences.GeckoPreferenceFragment" > android:fragment="org.mozilla.gecko.preferences.GeckoPreferenceFragment"
android:key="android.not_a_preference.devtools.enabled" >
<extra android:name="resource" <extra android:name="resource"
android:value="preferences_devtools"/> android:value="preferences_devtools"/>
</PreferenceScreen> </PreferenceScreen>

View File

@ -72,7 +72,8 @@
</intent> </intent>
</PreferenceScreen> </PreferenceScreen>
<PreferenceScreen android:title="@string/pref_category_devtools" <PreferenceScreen android:title="@string/pref_category_devtools"
android:summary="@string/pref_developer_remotedebugging" > android:summary="@string/pref_developer_remotedebugging"
android:key="android.not_a_preference.devtools.enabled" >
<intent android:action="android.intent.action.VIEW" <intent android:action="android.intent.action.VIEW"
android:targetPackage="@string/android_package_name" android:targetPackage="@string/android_package_name"
android:targetClass="org.mozilla.gecko.preferences.GeckoPreferences" > android:targetClass="org.mozilla.gecko.preferences.GeckoPreferences" >