am af6cdb2b: Merge "Pin protect going into developer mode." into klp-dev

* commit 'af6cdb2b30a875b0a563196bb5c405b080b3cbe0':
  Pin protect going into developer mode.
This commit is contained in:
Geoffrey Borggaard
2013-09-03 17:43:51 -07:00
committed by Android Git Automerger

View File

@@ -37,7 +37,7 @@ import java.io.IOException;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class DeviceInfoSettings extends SettingsPreferenceFragment { public class DeviceInfoSettings extends RestrictedSettingsFragment {
private static final String LOG_TAG = "DeviceInfoSettings"; private static final String LOG_TAG = "DeviceInfoSettings";
@@ -70,12 +70,20 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
int mDevHitCountdown; int mDevHitCountdown;
Toast mDevHitToast; Toast mDevHitToast;
public DeviceInfoSettings() {
super(null /* Don't PIN protect the entire screen */);
}
@Override @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
super.onCreate(icicle); super.onCreate(icicle);
addPreferencesFromResource(R.xml.device_info_settings); addPreferencesFromResource(R.xml.device_info_settings);
// We only call ensurePinRestrictedPreference() when mDevHitCountdown == 0.
// This will keep us from entering developer mode without a PIN.
protectByRestrictions(KEY_BUILD_NUMBER);
setStringSummary(KEY_FIRMWARE_VERSION, Build.VERSION.RELEASE); setStringSummary(KEY_FIRMWARE_VERSION, Build.VERSION.RELEASE);
findPreference(KEY_FIRMWARE_VERSION).setEnabled(true); findPreference(KEY_FIRMWARE_VERSION).setEnabled(true);
setValueSummary(KEY_BASEBAND_VERSION, "gsm.version.baseband"); setValueSummary(KEY_BASEBAND_VERSION, "gsm.version.baseband");
@@ -178,6 +186,11 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
if (UserHandle.myUserId() != UserHandle.USER_OWNER) return true; if (UserHandle.myUserId() != UserHandle.USER_OWNER) return true;
if (mDevHitCountdown > 0) { if (mDevHitCountdown > 0) {
if (mDevHitCountdown == 1) {
if (super.ensurePinRestrictedPreference(preference)) {
return true;
}
}
mDevHitCountdown--; mDevHitCountdown--;
if (mDevHitCountdown == 0) { if (mDevHitCountdown == 0) {
getActivity().getSharedPreferences(DevelopmentSettings.PREF_FILE, getActivity().getSharedPreferences(DevelopmentSettings.PREF_FILE,