Add a Global setting for disabling OEM unlocking setting

+ Don't enable OEM unlocking setting if the global setting disallows it.

Bug: 28163088
Change-Id: Ic306da3fa2cecb90865be055566a7e1603e6b5e2
This commit is contained in:
Steven Ng
2016-04-27 15:28:40 +01:00
parent 1bc12ee9c2
commit 3fe140315d
2 changed files with 10 additions and 4 deletions

View File

@@ -759,9 +759,13 @@ public final class Utils extends com.android.settingslib.Utils {
* devices allow users to flash other OSes to them.
*/
static void setOemUnlockEnabled(Context context, boolean enabled) {
PersistentDataBlockManager manager =(PersistentDataBlockManager)
context.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
manager.setOemUnlockEnabled(enabled);
try {
PersistentDataBlockManager manager = (PersistentDataBlockManager)
context.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
manager.setOemUnlockEnabled(enabled);
} catch (SecurityException e) {
Log.e(TAG, "Fail to set oem unlock.", e);
}
}
/**