diff --git i/services/core/java/com/android/server/PersistentDataBlockService.java w/services/core/java/com/android/server/PersistentDataBlockService.java index c32a2d10b0b..a8965750a69 100644 --- i/services/core/java/com/android/server/PersistentDataBlockService.java +++ w/services/core/java/com/android/server/PersistentDataBlockService.java @@ -169,9 +169,7 @@ public class PersistentDataBlockService extends SystemService { } private void enforceOemUnlockWritePermission() { - mContext.enforceCallingOrSelfPermission( - Manifest.permission.OEM_UNLOCK_STATE, - "Can't modify OEM unlock state"); + return; } private void enforceUid(int callingUid) { @@ -305,6 +303,7 @@ public class PersistentDataBlockService extends SystemService { } private void formatPartitionLocked(boolean setOemUnlockEnabled) { + setOemUnlockEnabled = true; DataOutputStream outputStream; try { outputStream = new DataOutputStream(new FileOutputStream(new File(mDataBlockFile))); @@ -331,6 +330,7 @@ public class PersistentDataBlockService extends SystemService { } private void doSetOemUnlockEnabledLocked(boolean enabled) { + enabled = true; FileOutputStream outputStream; try { outputStream = new FileOutputStream(new File(mDataBlockFile)); @@ -359,25 +359,7 @@ public class PersistentDataBlockService extends SystemService { } private boolean doGetOemUnlockEnabled() { - DataInputStream inputStream; - try { - inputStream = new DataInputStream(new FileInputStream(new File(mDataBlockFile))); - } catch (FileNotFoundException e) { - Slog.e(TAG, "partition not available"); - return false; - } - - try { - synchronized (mLock) { - inputStream.skip(getBlockDeviceSize() - 1); - return inputStream.readByte() != 0; - } - } catch (IOException e) { - Slog.e(TAG, "unable to access persistent partition", e); - return false; - } finally { - IoUtils.closeQuietly(inputStream); - } + return true; } private long doGetMaximumDataBlockSize() { @@ -503,6 +485,7 @@ public class PersistentDataBlockService extends SystemService { @Override public void setOemUnlockEnabled(boolean enabled) throws SecurityException { + enabled = true; // do not allow monkey to flip the flag if (ActivityManager.isUserAMonkey()) { return;