Merge "Use the correct method to check if device is encrypted" into lmp-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a865bb5df8
@ -728,12 +728,9 @@ public class LockPatternUtils {
|
|||||||
|
|
||||||
/** Update the encryption password if it is enabled **/
|
/** Update the encryption password if it is enabled **/
|
||||||
private void updateEncryptionPassword(final int type, final String password) {
|
private void updateEncryptionPassword(final int type, final String password) {
|
||||||
DevicePolicyManager dpm = getDevicePolicyManager();
|
if (!isDeviceEncryptionEnabled()) {
|
||||||
if (dpm.getStorageEncryptionStatus(getCurrentOrCallingUserId())
|
|
||||||
!= DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final IBinder service = ServiceManager.getService("mount");
|
final IBinder service = ServiceManager.getService("mount");
|
||||||
if (service == null) {
|
if (service == null) {
|
||||||
Log.e(TAG, "Could not find the mount service to update the encryption password");
|
Log.e(TAG, "Could not find the mount service to update the encryption password");
|
||||||
|
@ -3390,9 +3390,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
private int getEncryptionStatus() {
|
private int getEncryptionStatus() {
|
||||||
String status = SystemProperties.get("ro.crypto.state", "unsupported");
|
String status = SystemProperties.get("ro.crypto.state", "unsupported");
|
||||||
if ("encrypted".equalsIgnoreCase(status)) {
|
if ("encrypted".equalsIgnoreCase(status)) {
|
||||||
return LockPatternUtils.isDeviceEncrypted()
|
final long token = Binder.clearCallingIdentity();
|
||||||
? DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE
|
try {
|
||||||
: DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE;
|
return LockPatternUtils.isDeviceEncrypted()
|
||||||
|
? DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE
|
||||||
|
: DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE;
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
} else if ("unencrypted".equalsIgnoreCase(status)) {
|
} else if ("unencrypted".equalsIgnoreCase(status)) {
|
||||||
return DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE;
|
return DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user