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

Commit 1ebedeef authored by Evan Rosky's avatar Evan Rosky
Browse files

Separate out locked part of setLockScreenShown

This is now used "internally" (via windowOrganizerController) and
that already holds the lock and doesn't need permission checks.

For the sake of chain tracking, this also means we need to be able
to track internal calls through here synchronously.

Bug: 325114242
Test: N/A
Flag: EXEMPT mechanical refactor
Change-Id: I4752a08bf4bd2c3f703b556b498c47355271d465
parent 80e793c7
Loading
Loading
Loading
Loading
+36 −29
Original line number Diff line number Diff line
@@ -2988,9 +2988,18 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
            throw new SecurityException("Requires permission "
                    + android.Manifest.permission.DEVICE_POWER);
        }

        synchronized (mGlobalLock) {
        final long ident = Binder.clearCallingIdentity();
        try {
            synchronized (mGlobalLock) {
                setLockScreenShownLocked(keyguardShowing, aodShowing);
            }
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
    }

    @GuardedBy("mGlobalLock")
    void setLockScreenShownLocked(boolean keyguardShowing, boolean aodShowing) {
        if (mKeyguardShown != keyguardShowing) {
            mKeyguardShown = keyguardShowing;
            final Message msg = PooledLambda.obtainMessage(
@@ -3017,8 +3026,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
            maybeHideLockedProfileActivityLocked();
        } finally {
            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
                Binder.restoreCallingIdentity(ident);
            }
        }

        mH.post(() -> {
+1 −1
Original line number Diff line number Diff line
@@ -1865,7 +1865,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
        if (keyguardState != null) {
            boolean keyguardShowing = keyguardState.getKeyguardShowing();
            boolean aodShowing = keyguardState.getAodShowing();
            mService.setLockScreenShown(keyguardShowing, aodShowing);
            mService.setLockScreenShownLocked(keyguardShowing, aodShowing);
        }
        return effects;
    }