Use calling user ID when calling isDeviceLocked

If isDeviceLocked is called with clearCallingIdentity,
original userId should be explicitly passed

Bug: 67621847
Test: Manual
Change-Id: I2bcb92572898811cc96bda1149ef806e6239e929
This commit is contained in:
Fyodor Kupolov
2017-10-12 11:22:57 -07:00
committed by Siyamed Sinir
parent 7e3f20e249
commit 66bde67120

View File

@@ -435,11 +435,12 @@ public class ClipboardService extends SystemService {
}
private boolean isDeviceLocked() {
int callingUserId = UserHandle.getCallingUserId();
final long token = Binder.clearCallingIdentity();
try {
final KeyguardManager keyguardManager = getContext().getSystemService(
KeyguardManager.class);
return keyguardManager != null && keyguardManager.isDeviceLocked();
return keyguardManager != null && keyguardManager.isDeviceLocked(callingUserId);
} finally {
Binder.restoreCallingIdentity(token);
}