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

Commit 3f679f87 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: I712abfe8d542cd1be9c1816f407c8912321ac480
(cherry picked from commit 2fd9f7a0)
parent 7dd0c692
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -435,9 +435,14 @@ public class ClipboardService extends SystemService {
    }

    private boolean isDeviceLocked() {
        final long token = Binder.clearCallingIdentity();
        try {
            final KeyguardManager keyguardManager = getContext().getSystemService(
                    KeyguardManager.class);
            return keyguardManager != null && keyguardManager.isDeviceLocked();
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }

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