summaryrefslogtreecommitdiffstats
path: root/services/core/java/com/android/server/PersistentDataBlockService.java
diff options
context:
space:
mode:
authorAndres Morales <anmorales@google.com>2015-03-19 16:37:54 -0700
committerAndres Morales <anmorales@google.com>2015-03-19 16:42:21 -0700
commit5ca4cc576145466e616f236e63215e2fe33df91c (patch)
tree65f6cfd6278428896a5315590a1ffd058a8b0598 /services/core/java/com/android/server/PersistentDataBlockService.java
parente9d827aa5110e5338f0ba97ab1da0a1781425f14 (diff)
downloadframeworks_base-5ca4cc576145466e616f236e63215e2fe33df91c.zip
frameworks_base-5ca4cc576145466e616f236e63215e2fe33df91c.tar.gz
frameworks_base-5ca4cc576145466e616f236e63215e2fe33df91c.tar.bz2
Add system prop to track if oem unlock is allowed
This state is never trusted, but it permits us to build more appropriately message the user if their device is in a state where its OK to reset. Change-Id: I26cc0f928d7fdeff8837e4c2c4b8859fede7846d
Diffstat (limited to 'services/core/java/com/android/server/PersistentDataBlockService.java')
-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 e5ace1b..51fe2a9 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,12 +109,15 @@ public class PersistentDataBlockService extends SystemService {
}
private void formatIfOemUnlockEnabled() {
- if (doGetOemUnlockEnabled()) {
+ boolean enabled = doGetOemUnlockEnabled();
+ if (enabled) {
synchronized (mLock) {
formatPartitionLocked();
doSetOemUnlockEnabledLocked(true);
}
}
+
+ SystemProperties.set(OEM_UNLOCK_PROP, enabled ? "1" : "0");
}
private void enforceOemUnlockPermission() {
@@ -133,7 +137,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);
@@ -291,6 +294,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);
}
}