Fix ClipboardService device lock check for cross profile am: 6d79675e0c am: 095eda9307 am: a4f6ca3e77 am: 85439e9114 am: 17735f183a am: d93f91a137
am: 9865205a4e
Change-Id: I7c34d6b58d5aacadd6efa07ce12f9b7e9898768a
diff --git a/services/core/java/com/android/server/clipboard/ClipboardService.java b/services/core/java/com/android/server/clipboard/ClipboardService.java
index bdd2d2b..6f59e84 100644
--- a/services/core/java/com/android/server/clipboard/ClipboardService.java
+++ b/services/core/java/com/android/server/clipboard/ClipboardService.java
@@ -315,8 +315,14 @@
}
private boolean isDeviceLocked() {
- final KeyguardManager keyguardManager = mContext.getSystemService(KeyguardManager.class);
- return keyguardManager != null && keyguardManager.isDeviceLocked();
+ final long token = Binder.clearCallingIdentity();
+ try {
+ final KeyguardManager keyguardManager = mContext.getSystemService(
+ KeyguardManager.class);
+ return keyguardManager != null && keyguardManager.isDeviceLocked();
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
}
private final void checkUriOwnerLocked(Uri uri, int uid) {