Fix crash in KeyguardManager.isDeviceLocked
A missing clearCallingIdentity was causing crashes when
isDeviceLocked is queried.
Bug: 26576080
Change-Id: I2d78e803873a02861335a95b1bbf13a4d9b45655
diff --git a/services/core/java/com/android/server/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java
index 8cdff11..1d498e1 100644
--- a/services/core/java/com/android/server/trust/TrustManagerService.java
+++ b/services/core/java/com/android/server/trust/TrustManagerService.java
@@ -664,11 +664,16 @@
public boolean isDeviceLocked(int userId) throws RemoteException {
userId = ActivityManager.handleIncomingUser(getCallingPid(), getCallingUid(), userId,
false /* allowAll */, true /* requireFull */, "isDeviceLocked", null);
- if (!mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)) {
- userId = resolveProfileParent(userId);
- }
- return isDeviceLockedInner(userId);
+ long token = Binder.clearCallingIdentity();
+ try {
+ if (!mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)) {
+ userId = resolveProfileParent(userId);
+ }
+ return isDeviceLockedInner(userId);
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
}
@Override