Track ro.flash.locked bit to enable/disable OEM unlocking pref
if the device is OEM unlocked already, disable the OEM unlocking pref. If it's locked, enable. Bug: 26039090 Change-Id: I915f3cf57deef8f5775d466dec59c891c1546b1b
This commit is contained in:
@@ -203,6 +203,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
private static final int RESULT_MOCK_LOCATION_APP = 1001;
|
||||
|
||||
private static final String PERSISTENT_DATA_BLOCK_PROP = "ro.frp.pst";
|
||||
private static final String FLASH_LOCKED_PROP = "ro.boot.flash.locked";
|
||||
|
||||
private static final int REQUEST_CODE_ENABLE_OEM_UNLOCK = 0;
|
||||
|
||||
@@ -703,6 +704,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
updateForceResizableOptions();
|
||||
updateEnableFreeformWindowsSupportOptions();
|
||||
updateWebViewProviderOptions();
|
||||
updateOemUnlockOptions();
|
||||
if (mColorTemperaturePreference != null) {
|
||||
updateColorTemperature();
|
||||
}
|
||||
@@ -967,6 +969,17 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
return !SystemProperties.get(PERSISTENT_DATA_BLOCK_PROP).equals("");
|
||||
}
|
||||
|
||||
private static boolean enableOemUnlockPreference() {
|
||||
String flashLocked = SystemProperties.get(FLASH_LOCKED_PROP);
|
||||
return !"0".equals(flashLocked);
|
||||
}
|
||||
|
||||
private void updateOemUnlockOptions() {
|
||||
if (mEnableOemUnlock != null) {
|
||||
mEnableOemUnlock.setEnabled(enableOemUnlockPreference());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateBugreportOptions() {
|
||||
mBugreport.setEnabled(true);
|
||||
mBugreportInPower.setEnabled(true);
|
||||
|
Reference in New Issue
Block a user