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

Commit c7ed72ca authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Remove usages of isDisplayOccluded

The single occluded state should be only used inside KeyguardController.
The outer accesses should use isKeyguardOccluded that considers whether
keyguard is active.

Also removed ATMS#isKeyguardLocked which was no longer used.

Fix: 297188512
Test: atest ActivityRecordTests#testCompleteFinishing_showWhenLocked
Change-Id: I474015a36802e46f2448686f2f175e8e84e14956
parent ed35afbc
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -4048,10 +4048,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        mRecentTasks.notifyTaskPersisterLocked(task, flush);
    }

    boolean isKeyguardLocked(int displayId) {
        return mKeyguardController.isKeyguardLocked(displayId);
    }

    /**
     * Clears launch params for the given package.
     *
+6 −10
Original line number Diff line number Diff line
@@ -423,7 +423,7 @@ class KeyguardController {

        final TransitionController tc = mRootWindowContainer.mTransitionController;

        final boolean occluded = isDisplayOccluded(displayId);
        final boolean occluded = getDisplayState(displayId).mOccluded;
        final boolean performTransition = isKeyguardLocked(displayId);
        final boolean executeTransition = performTransition && !tc.isCollecting();

@@ -500,15 +500,6 @@ class KeyguardController {
        }
    }

    /**
     * Returns {@code true} if the top activity on the display can occlude keyguard or the device
     * is dreaming. Note that this method may return {@code true} even if the keyguard is disabled
     * or not showing.
     */
    boolean isDisplayOccluded(int displayId) {
        return getDisplayState(displayId).mOccluded;
    }

    ActivityRecord getTopOccludingActivity(int displayId) {
        return getDisplayState(displayId).mTopOccludesActivity;
    }
@@ -601,6 +592,11 @@ class KeyguardController {
        private boolean mAodShowing;
        private boolean mKeyguardGoingAway;
        private boolean mDismissalRequested;

        /**
         * True if the top activity on the display can occlude keyguard or the device is dreaming.
         * Note that this can be true even if the keyguard is disabled or not showing.
         */
        private boolean mOccluded;
        private boolean mShowingDream;

+1 −1
Original line number Diff line number Diff line
@@ -2699,7 +2699,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
            // transition exists, so this affects only when no lock screen is set. Otherwise
            // keyguard going away animation will be played.
            // See also AppTransitionController#getTransitCompatType for more details.
            if ((!mTaskSupervisor.getKeyguardController().isDisplayOccluded(display.mDisplayId)
            if ((!mTaskSupervisor.getKeyguardController().isKeyguardOccluded(display.mDisplayId)
                    && token.mTag.equals(KEYGUARD_SLEEP_TOKEN_TAG))
                    || token.mTag.equals(DISPLAY_OFF_SLEEP_TOKEN_TAG)) {
                display.mSkipAppTransitionAnimation = true;
+1 −1
Original line number Diff line number Diff line
@@ -3579,7 +3579,7 @@ class Task extends TaskFragment {
                && activity.info != info.taskInfo.topActivityInfo
                ? activity.info : null;
        info.isKeyguardOccluded =
            mAtmService.mKeyguardController.isDisplayOccluded(DEFAULT_DISPLAY);
                mAtmService.mKeyguardController.isKeyguardOccluded(info.taskInfo.displayId);

        info.startingWindowTypeParameter = activity.mStartingData != null
                ? activity.mStartingData.mTypeParams
+4 −3
Original line number Diff line number Diff line
@@ -1541,7 +1541,8 @@ public class ActivityRecordTests extends WindowTestsBase {
        // Make keyguard locked and set the top activity show-when-locked.
        KeyguardController keyguardController = activity.mTaskSupervisor.getKeyguardController();
        int displayId = activity.getDisplayId();
        doReturn(true).when(keyguardController).isKeyguardLocked(eq(displayId));
        keyguardController.setKeyguardShown(displayId, true /* keyguardShowing */,
                false /* aodShowing */);
        final ActivityRecord topActivity = new ActivityBuilder(mAtm).setTask(task).build();
        topActivity.setVisibleRequested(true);
        topActivity.nowVisible = true;
@@ -1553,7 +1554,7 @@ public class ActivityRecordTests extends WindowTestsBase {

        // Verify the stack-top activity is occluded keyguard.
        assertEquals(topActivity, task.topRunningActivity());
        assertTrue(keyguardController.isDisplayOccluded(DEFAULT_DISPLAY));
        assertTrue(keyguardController.isKeyguardOccluded(displayId));

        // Finish the top activity
        topActivity.setState(PAUSED, "true");
@@ -1562,7 +1563,7 @@ public class ActivityRecordTests extends WindowTestsBase {

        // Verify new top activity does not occlude keyguard.
        assertEquals(activity, task.topRunningActivity());
        assertFalse(keyguardController.isDisplayOccluded(DEFAULT_DISPLAY));
        assertFalse(keyguardController.isKeyguardOccluded(displayId));
    }

    /**
Loading