Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0595b5a9 authored by Siyamed Sinir's avatar Siyamed Sinir
Browse files

Fix ClipboardService device lock check for cross profile

ClipboardService.isDeviceLocked should clear callingIdentity before
accessing KeyguardManager.

Test: bit CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.ManagedProfileTest

Bug: 64934810
Change-Id: Iffc8e73dd3ee14a94958bb50dd11a696eab7f052
parent 271702fc
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -307,10 +307,15 @@ public class ClipboardService extends IClipboard.Stub {
    }

    private boolean isDeviceLocked() {
        final long token = Binder.clearCallingIdentity();
        try {
            final KeyguardManager keyguardManager = (KeyguardManager) mContext.getSystemService(
                        Context.KEYGUARD_SERVICE);
            return keyguardManager != null && keyguardManager.isKeyguardLocked()
                    && keyguardManager.isKeyguardSecure();
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }

    private final void checkUriOwnerLocked(Uri uri, int uid) {