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

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

Merge "Schedule sleep transition only if screen is non-interactive" into main

parents 2cb71cc1 d52e056b
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
@@ -2559,8 +2559,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)) {
@@ -3885,6 +3885,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