summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Amith Yamasani <yamasani@google.com> 2014-10-17 19:00:36 +0000
committer Android Git Automerger <android-git-automerger@android.com> 2014-10-17 19:00:36 +0000
commitb5afeca3d9ce3efb0ab9ab6536d4446ec73b416c (patch)
treec8f8940f68039acf01c2345ecafe6c2e7ff21a2f
parente62a4a50cf2cc4c26f8616d09bed30e94a7699ca (diff)
parenta865bb5df834194dee339db615c17d7c7b63aaa3 (diff)
am a865bb5d: Merge "Use the correct method to check if device is encrypted" into lmp-dev
* commit 'a865bb5df834194dee339db615c17d7c7b63aaa3': Use the correct method to check if device is encrypted
-rw-r--r--core/java/com/android/internal/widget/LockPatternUtils.java5
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java11
2 files changed, 9 insertions, 7 deletions
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 9a1c9fc15d34..412b4d2dc95c 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -728,12 +728,9 @@ public class LockPatternUtils {
/** Update the encryption password if it is enabled **/
private void updateEncryptionPassword(final int type, final String password) {
- DevicePolicyManager dpm = getDevicePolicyManager();
- if (dpm.getStorageEncryptionStatus(getCurrentOrCallingUserId())
- != DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE) {
+ if (!isDeviceEncryptionEnabled()) {
return;
}
-
final IBinder service = ServiceManager.getService("mount");
if (service == null) {
Log.e(TAG, "Could not find the mount service to update the encryption password");
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index fc5c053fd156..fe4b7b9cc949 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -3390,9 +3390,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
private int getEncryptionStatus() {
String status = SystemProperties.get("ro.crypto.state", "unsupported");
if ("encrypted".equalsIgnoreCase(status)) {
- return LockPatternUtils.isDeviceEncrypted()
- ? DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE
- : DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE;
+ final long token = Binder.clearCallingIdentity();
+ try {
+ return LockPatternUtils.isDeviceEncrypted()
+ ? DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE
+ : DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE;
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
} else if ("unencrypted".equalsIgnoreCase(status)) {
return DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE;
} else {