am 7d3e182c
: Merge changes I326a4cf2,I1cfce513 into lmp-mr1-dev automerge: ea4d9a9
automerge: eb55ac9
* commit '7d3e182c18978c7da43194d9deb564e5724b06e2': Confirm enabling OEM unlock with warning dialog Request PIN confirmation to enable OEM unlock
This commit is contained in:
@@ -3400,6 +3400,15 @@
|
||||
<string name="oem_unlock_enable">Enable OEM unlock</string>
|
||||
<!-- setting Checkbox summary whether to enable OEM unlock [CHAR_LIMIT=50] -->
|
||||
<string name="oem_unlock_enable_summary">Allow the device to be OEM unlocked</string>
|
||||
<!-- Message to enter device PIN to enable OEM unlock -->
|
||||
<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 -->
|
||||
<string name="wifi_display_certification">Wireless display certification</string>
|
||||
|
@@ -33,6 +33,7 @@ import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.hardware.usb.IUsbManager;
|
||||
import android.hardware.usb.UsbManager;
|
||||
import android.net.wifi.WifiManager;
|
||||
@@ -167,6 +168,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
|
||||
private static final String PERSISTENT_DATA_BLOCK_PROP = "ro.frp.pst";
|
||||
|
||||
private static final int REQUEST_CODE_ENABLE_OEM_UNLOCK = 0;
|
||||
|
||||
private static String DEFAULT_LOG_RING_BUFFER_SIZE_IN_BYTES = "262144"; // 256K
|
||||
|
||||
private IWindowManager mWindowManager;
|
||||
@@ -1320,6 +1323,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()) {
|
||||
@@ -1355,6 +1376,14 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
writeDebuggerOptions();
|
||||
updateDebuggerOptions();
|
||||
}
|
||||
} else if (requestCode == REQUEST_CODE_ENABLE_OEM_UNLOCK) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
if (mEnableOemUnlock.isChecked()) {
|
||||
confirmEnableOemUnlock();
|
||||
} else {
|
||||
Utils.setOemUnlockEnabled(getActivity(), false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
@@ -1408,7 +1437,13 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
} else if (preference == mBtHciSnoopLog) {
|
||||
writeBtHciSnoopLogOptions();
|
||||
} else if (preference == mEnableOemUnlock) {
|
||||
Utils.setOemUnlockEnabled(getActivity(), mEnableOemUnlock.isChecked());
|
||||
if (!showKeyguardConfirmation(getResources(), REQUEST_CODE_ENABLE_OEM_UNLOCK)) {
|
||||
if (mEnableOemUnlock.isChecked()) {
|
||||
confirmEnableOemUnlock();
|
||||
} else {
|
||||
Utils.setOemUnlockEnabled(getActivity(), false);
|
||||
}
|
||||
}
|
||||
} else if (preference == mAllowMockLocation) {
|
||||
Settings.Secure.putInt(getActivity().getContentResolver(),
|
||||
Settings.Secure.ALLOW_MOCK_LOCATION,
|
||||
@@ -1470,6 +1505,13 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean showKeyguardConfirmation(Resources resources, int requestCode) {
|
||||
return new ChooseLockSettingsHelper(getActivity(), this)
|
||||
.launchConfirmationActivity(requestCode,
|
||||
resources.getString(R.string.oem_unlock_enable_pin_prompt),
|
||||
resources.getString(R.string.oem_unlock_enable_pin_description));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
if (HDCP_CHECKING_KEY.equals(preference.getKey())) {
|
||||
|
Reference in New Issue
Block a user