Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 48b0b241 authored by Andres Morales's avatar Andres Morales
Browse files

Confirm enabling OEM unlock with warning dialog

Bug: 18227644
Change-Id: I326a4cf215ef0e30fd8a054964e0efeb3f627d89
parent 73bbd4cb
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3396,6 +3396,10 @@
    <string name="oem_unlock_enable_pin_prompt">Enter your PIN</string>
    <!-- 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>
    <!-- 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 -->
+28 −2
Original line number Diff line number Diff line
@@ -1279,6 +1279,24 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
                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
    public void onSwitchChanged(Switch switchView, boolean isChecked) {
        if (switchView != mSwitchBar.getSwitch()) {
@@ -1316,7 +1334,11 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
            }
        } else if (requestCode == REQUEST_CODE_ENABLE_OEM_UNLOCK) {
            if (resultCode == Activity.RESULT_OK) {
                Utils.setOemUnlockEnabled(getActivity(), mEnableOemUnlock.isChecked());
                if (mEnableOemUnlock.isChecked()) {
                    confirmEnableOemUnlock();
                } else {
                    Utils.setOemUnlockEnabled(getActivity(), false);
                }
            }
        } else {
            super.onActivityResult(requestCode, resultCode, data);
@@ -1372,7 +1394,11 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
            writeBtHciSnoopLogOptions();
        } else if (preference == mEnableOemUnlock) {
            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) {
            Settings.Secure.putInt(getActivity().getContentResolver(),