summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndres Morales <anmorales@google.com>2015-03-27 18:18:28 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-03-27 18:18:30 +0000
commitfb5dcacf41479434c497f1934646d0110ab73089 (patch)
tree426c8bdba27187b047fd094ed74bbbf8c456cfed
parentacc6241da915e463e46407348dcdbf60b4ca753f (diff)
parent5ca4cc576145466e616f236e63215e2fe33df91c (diff)
downloadframeworks_base-fb5dcacf41479434c497f1934646d0110ab73089.zip
frameworks_base-fb5dcacf41479434c497f1934646d0110ab73089.tar.gz
frameworks_base-fb5dcacf41479434c497f1934646d0110ab73089.tar.bz2
Merge "Add system prop to track if oem unlock is allowed"
-rw-r--r--services/core/java/com/android/server/PersistentDataBlockService.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/PersistentDataBlockService.java b/services/core/java/com/android/server/PersistentDataBlockService.java
index 97d16c0..b36f515 100644
--- a/services/core/java/com/android/server/PersistentDataBlockService.java
+++ b/services/core/java/com/android/server/PersistentDataBlockService.java
@@ -70,6 +70,7 @@ public class PersistentDataBlockService extends SystemService {
// Limit to 100k as blocks larger than this might cause strain on Binder.
private static final int MAX_DATA_BLOCK_SIZE = 1024 * 100;
public static final int DIGEST_SIZE_BYTES = 32;
+ private static final String OEM_UNLOCK_PROP = "sys.oem_unlock_allowed";
private final Context mContext;
private final String mDataBlockFile;
@@ -108,11 +109,14 @@ public class PersistentDataBlockService extends SystemService {
}
private void formatIfOemUnlockEnabled() {
- if (doGetOemUnlockEnabled()) {
+ boolean enabled = doGetOemUnlockEnabled();
+ if (enabled) {
synchronized (mLock) {
formatPartitionLocked(true);
}
}
+
+ SystemProperties.set(OEM_UNLOCK_PROP, enabled ? "1" : "0");
}
private void enforceOemUnlockPermission() {
@@ -132,7 +136,6 @@ public class PersistentDataBlockService extends SystemService {
throw new SecurityException("Only the Owner is allowed to change OEM unlock state");
}
}
-
private int getTotalDataSizeLocked(DataInputStream inputStream) throws IOException {
// skip over checksum
inputStream.skipBytes(DIGEST_SIZE_BYTES);
@@ -290,6 +293,7 @@ public class PersistentDataBlockService extends SystemService {
Slog.e(TAG, "unable to access persistent partition", e);
return;
} finally {
+ SystemProperties.set(OEM_UNLOCK_PROP, enabled ? "1" : "0");
IoUtils.closeQuietly(outputStream);
}
}