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

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

Schedule sleep transition only if screen is non-interactive

TRANSIT_SLEEP is mainly for screen off. In case there is only
keyguard sleep token and a display change transition happens.
The change transition should not be disturbed by TRANSIT_SLEEP.

Bug: 408450324
Flag: EXEMPT bugfix
Test: Fold device with Settings > Display
       > Continue using apps on fold > Swipe up to continue
      There won't be MSG_SEND_SLEEP_TRANSITION.
Change-Id: Iad9b1e56dd7a0f6965d8f7263d75d4929f415853
parent 1b73388e
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -6530,6 +6530,17 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
                && (mAtmService.mRunningVoice == null);
    }

    /** Returns {@code} if the screen is not in a fully interactive state. */
    boolean isScreenSleeping() {
        for (int i = mAllSleepTokens.size() - 1; i >= 0; i--) {
            if (mAllSleepTokens.get(i).isScreenOff()) {
                return true;
            }
        }
        // If AOD is active, there may be only keyguard sleep token but awake state is false.
        // Then still treat the case as sleeping.
        return !mAllSleepTokens.isEmpty() && !mDisplayPolicy.isAwake();
    }

    void ensureActivitiesVisible(ActivityRecord starting, boolean notifyClients) {
        if (mInEnsureActivitiesVisible) {
+6 −2
Original line number Diff line number Diff line
@@ -2555,8 +2555,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent>

            if (display.mTransitionController.isShellTransitionsEnabled()
                    && !scheduledSleepTransition
                    // Only care if there are actual sleep tokens.
                    && displayShouldSleep && !display.mAllSleepTokens.isEmpty()) {
                    // Only care if there are actual sleep states.
                    && displayShouldSleep && display.isScreenSleeping()) {
                scheduledSleepTransition = true;

                if (!mHandler.hasMessages(MSG_SEND_SLEEP_TRANSITION)) {
@@ -3881,6 +3881,10 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
            mHashKey = makeSleepTokenKey(mTag, mDisplayId);
        }

        boolean isScreenOff() {
            return DISPLAY_OFF_SLEEP_TOKEN_TAG.equals(mTag);
        }

        @Override
        public String toString() {
            return "{\"" + mTag + "\", display " + mDisplayId