summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/oemlock/PersistentDataBlockLock.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/oemlock/PersistentDataBlockLock.java b/services/core/java/com/android/server/oemlock/PersistentDataBlockLock.java
index a1c27d6432f1..2474b2aa9184 100644
--- a/services/core/java/com/android/server/oemlock/PersistentDataBlockLock.java
+++ b/services/core/java/com/android/server/oemlock/PersistentDataBlockLock.java
@@ -73,6 +73,10 @@ class PersistentDataBlockLock extends OemLock {
// unlocked but doesn't actually do any unlocking.
final PersistentDataBlockManager pdbm = (PersistentDataBlockManager)
mContext.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
+ if (pdbm == null) {
+ Slog.w(TAG, "PersistentDataBlock is not supported on this device");
+ return;
+ }
pdbm.setOemUnlockEnabled(allowedByDevice);
}
@@ -80,6 +84,10 @@ class PersistentDataBlockLock extends OemLock {
boolean isOemUnlockAllowedByDevice() {
final PersistentDataBlockManager pdbm = (PersistentDataBlockManager)
mContext.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
+ if (pdbm == null) {
+ Slog.w(TAG, "PersistentDataBlock is not supported on this device");
+ return false;
+ }
return pdbm.getOemUnlockEnabled();
}
@@ -91,6 +99,10 @@ class PersistentDataBlockLock extends OemLock {
private void disallowUnlockIfNotUnlocked() {
final PersistentDataBlockManager pdbm = (PersistentDataBlockManager)
mContext.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
+ if (pdbm == null) {
+ Slog.w(TAG, "PersistentDataBlock is not supported on this device");
+ return;
+ }
if (pdbm.getFlashLockState() != PersistentDataBlockManager.FLASH_LOCK_UNLOCKED) {
pdbm.setOemUnlockEnabled(false);
}