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

Commit 1fd24467 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Reduce confusing usages of checking occluded keyguard" into main

parents 1d0b4499 f8fe742a
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -2705,8 +2705,7 @@ class ActivityStarter {
            mTransientLaunch = mOptions.getTransientLaunch();
            final KeyguardController kc = mSupervisor.getKeyguardController();
            final int displayId = mPreferredTaskDisplayArea.getDisplayId();
            mDisplayLockAndOccluded = kc.isKeyguardLocked(displayId)
                    && kc.isDisplayOccluded(displayId);
            mDisplayLockAndOccluded = kc.isKeyguardOccluded(displayId);
            // Recents animation on lock screen, do not resume & move launcher to top.
            if (mTransientLaunch && mDisplayLockAndOccluded
                    && mService.getTransitionController().isShellTransitionsEnabled()) {
+1 −1
Original line number Diff line number Diff line
@@ -409,7 +409,7 @@ class BackNavigationController {
    boolean isKeyguardOccluded(WindowState focusWindow) {
        final KeyguardController kc = mWindowManagerService.mAtmService.mKeyguardController;
        final int displayId = focusWindow.getDisplayId();
        return kc.isKeyguardLocked(displayId) && kc.isDisplayOccluded(displayId);
        return kc.isKeyguardOccluded(displayId);
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -6546,7 +6546,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
     */
    boolean isKeyguardOccluded() {
        return mRootWindowContainer.mTaskSupervisor
                .getKeyguardController().isDisplayOccluded(mDisplayId);
                .getKeyguardController().isKeyguardOccluded(mDisplayId);
    }

    /**
+11 −4
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ class KeyguardController {
        final KeyguardDisplayState state = getDisplayState(displayId);
        return (state.mKeyguardShowing || state.mAodShowing)
                && !state.mKeyguardGoingAway
                && !isDisplayOccluded(displayId);
                && !state.mOccluded;
    }

    /**
@@ -134,8 +134,7 @@ class KeyguardController {
     */
    boolean isKeyguardShowing(int displayId) {
        final KeyguardDisplayState state = getDisplayState(displayId);
        return state.mKeyguardShowing && !state.mKeyguardGoingAway
                && !isDisplayOccluded(displayId);
        return state.mKeyguardShowing && !state.mKeyguardGoingAway && !state.mOccluded;
    }

    /**
@@ -146,6 +145,12 @@ class KeyguardController {
        return state.mKeyguardShowing && !state.mKeyguardGoingAway;
    }

    /** Returns {code @true} if Keyguard is occluded while it is showing and not going away. */
    boolean isKeyguardOccluded(int displayId) {
        final KeyguardDisplayState state = getDisplayState(displayId);
        return state.mKeyguardShowing && !state.mKeyguardGoingAway && state.mOccluded;
    }

    /**
     *
     * @return true if the activity is controlling keyguard state.
@@ -496,7 +501,9 @@ class KeyguardController {
    }

    /**
     * @return true if Keyguard is occluded or the device is dreaming.
     * 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;
+4 −5
Original line number Diff line number Diff line
@@ -2405,6 +2405,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
            // Prepare transition before resume top activity, so it can be collected.
            if (!displayShouldSleep && display.mTransitionController.isShellTransitionsEnabled()
                    && !display.mTransitionController.isCollecting()) {
                // Use NONE if keyguard is not showing.
                int transit = TRANSIT_NONE;
                Task startTask = null;
                if (!display.getDisplayPolicy().isAwake()) {
@@ -2416,12 +2417,10 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
                    transit = WindowManager.TRANSIT_KEYGUARD_OCCLUDE;
                    startTask = display.getTaskOccludingKeyguard();
                }
                if (transit != TRANSIT_NONE) {
                display.mTransitionController.requestStartTransition(
                        display.mTransitionController.createTransition(transit),
                        startTask, null /* remoteTransition */, null /* displayChange */);
            }
            }
            // Set the sleeping state of the root tasks on the display.
            display.forAllRootTasks(rootTask -> {
                if (displayShouldSleep) {
Loading