Restriction pin changes.

Fixed bug in WirelessSettings where it was asking users for a PIN when
they weren't restricted.  Did this by refactoring the preference level
pin checking into the superclass, where it checks for the restricted mode first.
Also pin protected changes to certificates for restricted users.

Change-Id: I8310fd39f0862159668318fc1360ec6859cc00d5
This commit is contained in:
Geoffrey Borggaard
2013-08-07 14:57:43 -04:00
parent 8a181dd0d1
commit 6e1102d9fa
7 changed files with 98 additions and 40 deletions

View File

@@ -54,7 +54,6 @@ import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceFragment;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import android.provider.Settings;
@@ -210,7 +209,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
= new ArrayList<CheckBoxPreference>();
private final HashSet<Preference> mDisabledPrefs = new HashSet<Preference>();
private final HashSet<Preference> mProtectedByRestrictionsPrefs = new HashSet<Preference>();
// To track whether a confirmation dialog was clicked.
private boolean mDialogClicked;
@@ -362,12 +360,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
}
}
private void protectByRestrictions(Preference pref) {
if (pref != null) {
mProtectedByRestrictionsPrefs.add(pref);
}
}
private CheckBoxPreference findAndInitCheckboxPref(String key) {
CheckBoxPreference pref = (CheckBoxPreference) findPreference(key);
if (pref == null) {
@@ -1178,11 +1170,9 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
if (mProtectedByRestrictionsPrefs.contains(preference)
&& !restrictionsPinCheck(RESTRICTIONS_PIN_SET)) {
return false;
if (super.onPreferenceTreeClick(preferenceScreen, preference)) {
return true;
}
if (Utils.isMonkeyRunning()) {
return false;
}