fix issue when cancelling OEM unlocking change

Bug: 26928752
Change-Id: Ibafe9df564f1035cbd6782d8982bc3b424ee3cb4
This commit is contained in:
Andres Morales
2016-02-09 11:10:10 -08:00
parent 08331aca4e
commit 8b85fbfe51

View File

@@ -1702,10 +1702,18 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
} }
private void confirmEnableOemUnlock() { private void confirmEnableOemUnlock() {
DialogInterface.OnClickListener onConfirmListener = new DialogInterface.OnClickListener() { DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
Utils.setOemUnlockEnabled(getActivity(), true); if (which == DialogInterface.BUTTON_POSITIVE) {
Utils.setOemUnlockEnabled(getActivity(), true);
}
}
};
DialogInterface.OnDismissListener onDismissListener = new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
updateAllOptions(); updateAllOptions();
} }
}; };
@@ -1713,8 +1721,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
new AlertDialog.Builder(getActivity()) new AlertDialog.Builder(getActivity())
.setTitle(R.string.confirm_enable_oem_unlock_title) .setTitle(R.string.confirm_enable_oem_unlock_title)
.setMessage(R.string.confirm_enable_oem_unlock_text) .setMessage(R.string.confirm_enable_oem_unlock_text)
.setPositiveButton(R.string.enable_text, onConfirmListener) .setPositiveButton(R.string.enable_text, onClickListener)
.setNegativeButton(android.R.string.cancel, null) .setNegativeButton(android.R.string.cancel, null)
.setOnDismissListener(onDismissListener)
.create() .create()
.show(); .show();
} }