Confirm enabling OEM unlock with warning dialog
Bug: 18227644 Change-Id: I326a4cf215ef0e30fd8a054964e0efeb3f627d89
This commit is contained in:
@@ -3396,6 +3396,10 @@
|
|||||||
<string name="oem_unlock_enable_pin_prompt">Enter your PIN</string>
|
<string name="oem_unlock_enable_pin_prompt">Enter your PIN</string>
|
||||||
<!-- Explanation to enter device pin to enable OEM unlock -->
|
<!-- Explanation to enter device pin to enable OEM unlock -->
|
||||||
<string name="oem_unlock_enable_pin_description">Enter your device PIN to enable OEM unlock</string>
|
<string name="oem_unlock_enable_pin_description">Enter your device PIN to enable OEM unlock</string>
|
||||||
|
<!-- Confirmation dialog title to ensure user wishes to enable OEM unlock and disable theft protection features -->
|
||||||
|
<string name="confirm_enable_oem_unlock_title">Warning</string>
|
||||||
|
<!-- Confirmation dialog message to ensure user wishes to enable OEM unlock and disable theft protection features -->
|
||||||
|
<string name="confirm_enable_oem_unlock_text">Enabling OEM unlock disables theft protection features on this device and may void your warranty. Continue?</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- Setting Checkbox title whether to show options for wireless display certification -->
|
<!-- Setting Checkbox title whether to show options for wireless display certification -->
|
||||||
|
@@ -1279,6 +1279,24 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
getActivity().getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0);
|
getActivity().getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void confirmEnableOemUnlock() {
|
||||||
|
DialogInterface.OnClickListener onConfirmListener = new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
Utils.setOemUnlockEnabled(getActivity(), true);
|
||||||
|
updateAllOptions();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
new AlertDialog.Builder(getActivity())
|
||||||
|
.setTitle(R.string.confirm_enable_oem_unlock_title)
|
||||||
|
.setMessage(R.string.confirm_enable_oem_unlock_text)
|
||||||
|
.setPositiveButton(R.string.yes, onConfirmListener)
|
||||||
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
|
.create()
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSwitchChanged(Switch switchView, boolean isChecked) {
|
public void onSwitchChanged(Switch switchView, boolean isChecked) {
|
||||||
if (switchView != mSwitchBar.getSwitch()) {
|
if (switchView != mSwitchBar.getSwitch()) {
|
||||||
@@ -1316,7 +1334,11 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
} else if (requestCode == REQUEST_CODE_ENABLE_OEM_UNLOCK) {
|
} else if (requestCode == REQUEST_CODE_ENABLE_OEM_UNLOCK) {
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
Utils.setOemUnlockEnabled(getActivity(), mEnableOemUnlock.isChecked());
|
if (mEnableOemUnlock.isChecked()) {
|
||||||
|
confirmEnableOemUnlock();
|
||||||
|
} else {
|
||||||
|
Utils.setOemUnlockEnabled(getActivity(), false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
@@ -1372,7 +1394,11 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
writeBtHciSnoopLogOptions();
|
writeBtHciSnoopLogOptions();
|
||||||
} else if (preference == mEnableOemUnlock) {
|
} else if (preference == mEnableOemUnlock) {
|
||||||
if (!showKeyguardConfirmation(getResources(), REQUEST_CODE_ENABLE_OEM_UNLOCK)) {
|
if (!showKeyguardConfirmation(getResources(), REQUEST_CODE_ENABLE_OEM_UNLOCK)) {
|
||||||
Utils.setOemUnlockEnabled(getActivity(), mEnableOemUnlock.isChecked());
|
if (mEnableOemUnlock.isChecked()) {
|
||||||
|
confirmEnableOemUnlock();
|
||||||
|
} else {
|
||||||
|
Utils.setOemUnlockEnabled(getActivity(), false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (preference == mAllowMockLocation) {
|
} else if (preference == mAllowMockLocation) {
|
||||||
Settings.Secure.putInt(getActivity().getContentResolver(),
|
Settings.Secure.putInt(getActivity().getContentResolver(),
|
||||||
|
Reference in New Issue
Block a user