Merge "Disallow OEM unlock when DISALLOW_FACTORY_RESET applies" into nyc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e6e8c92134
@@ -51,10 +51,11 @@
|
|||||||
android:title="@string/bt_hci_snoop_log"
|
android:title="@string/bt_hci_snoop_log"
|
||||||
android:summary="@string/bt_hci_snoop_log_summary"/>
|
android:summary="@string/bt_hci_snoop_log_summary"/>
|
||||||
|
|
||||||
<SwitchPreference
|
<com.android.settingslib.RestrictedSwitchPreference
|
||||||
android:key="oem_unlock_enable"
|
android:key="oem_unlock_enable"
|
||||||
android:title="@string/oem_unlock_enable"
|
android:title="@string/oem_unlock_enable"
|
||||||
android:summary="@string/oem_unlock_enable_summary"/>
|
android:summary="@string/oem_unlock_enable_summary"
|
||||||
|
settings:useAdditionalSummary="true"/>
|
||||||
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:key="running_apps"
|
android:key="running_apps"
|
||||||
|
@@ -239,7 +239,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
|||||||
private SwitchPreference mBugreportInPower;
|
private SwitchPreference mBugreportInPower;
|
||||||
private RestrictedSwitchPreference mKeepScreenOn;
|
private RestrictedSwitchPreference mKeepScreenOn;
|
||||||
private SwitchPreference mBtHciSnoopLog;
|
private SwitchPreference mBtHciSnoopLog;
|
||||||
private SwitchPreference mEnableOemUnlock;
|
private RestrictedSwitchPreference mEnableOemUnlock;
|
||||||
private SwitchPreference mDebugViewAttributes;
|
private SwitchPreference mDebugViewAttributes;
|
||||||
private SwitchPreference mForceAllowOnExternal;
|
private SwitchPreference mForceAllowOnExternal;
|
||||||
|
|
||||||
@@ -372,7 +372,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
|||||||
mBugreportInPower = findAndInitSwitchPref(BUGREPORT_IN_POWER_KEY);
|
mBugreportInPower = findAndInitSwitchPref(BUGREPORT_IN_POWER_KEY);
|
||||||
mKeepScreenOn = (RestrictedSwitchPreference) findAndInitSwitchPref(KEEP_SCREEN_ON);
|
mKeepScreenOn = (RestrictedSwitchPreference) findAndInitSwitchPref(KEEP_SCREEN_ON);
|
||||||
mBtHciSnoopLog = findAndInitSwitchPref(BT_HCI_SNOOP_LOG);
|
mBtHciSnoopLog = findAndInitSwitchPref(BT_HCI_SNOOP_LOG);
|
||||||
mEnableOemUnlock = findAndInitSwitchPref(ENABLE_OEM_UNLOCK);
|
mEnableOemUnlock = (RestrictedSwitchPreference) findAndInitSwitchPref(ENABLE_OEM_UNLOCK);
|
||||||
if (!showEnableOemUnlockPreference()) {
|
if (!showEnableOemUnlockPreference()) {
|
||||||
removePreference(mEnableOemUnlock);
|
removePreference(mEnableOemUnlock);
|
||||||
mEnableOemUnlock = null;
|
mEnableOemUnlock = null;
|
||||||
@@ -1021,7 +1021,21 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
|||||||
|
|
||||||
private void updateOemUnlockOptions() {
|
private void updateOemUnlockOptions() {
|
||||||
if (mEnableOemUnlock != null) {
|
if (mEnableOemUnlock != null) {
|
||||||
|
// Showing mEnableOemUnlock preference as device has persistent data block.
|
||||||
|
mEnableOemUnlock.setDisabledByAdmin(null);
|
||||||
mEnableOemUnlock.setEnabled(enableOemUnlockPreference());
|
mEnableOemUnlock.setEnabled(enableOemUnlockPreference());
|
||||||
|
if (mEnableOemUnlock.isEnabled()) {
|
||||||
|
// mEnableOemUnlock is enabled as device's flash lock is unlocked.
|
||||||
|
if (RestrictedLockUtils.hasBaseUserRestriction(getActivity(),
|
||||||
|
UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId())) {
|
||||||
|
// Set mEnableOemUnlock to disabled as restriction is set, but not by admin.
|
||||||
|
mEnableOemUnlock.setEnabled(false);
|
||||||
|
} else {
|
||||||
|
// Check restriction, disable mEnableOemUnlock and apply policy transparency.
|
||||||
|
mEnableOemUnlock
|
||||||
|
.checkRestrictionAndSetDisabled(UserManager.DISALLOW_FACTORY_RESET);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user