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

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

Merge "Clean up outdated path of sleep token for swapping display" into main

parents 9d11c71a a1f62377
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -69,17 +69,6 @@ flag {
  bug: "291870756"
}

flag {
  name: "skip_sleeping_when_switching_display"
  namespace: "windowing_frontend"
  description: "Reduce unnecessary visibility or lifecycle changes when changing fold state"
  bug: "303241079"
  is_fixed_read_only: true
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "introduce_smoother_dimmer"
  namespace: "windowing_frontend"
+7 −9
Original line number Diff line number Diff line
@@ -5496,9 +5496,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        // In case startedGoingToSleep is called after screenTurnedOff (the source caller is in
        // order but the methods run on different threads) and updateScreenOffSleepToken was
        // skipped. Then acquire sleep token if screen was off.
        if (!mDefaultDisplayPolicy.isScreenOnFully() && !mDefaultDisplayPolicy.isScreenOnEarly()
                && com.android.window.flags.Flags.skipSleepingWhenSwitchingDisplay()) {
            updateScreenOffSleepToken(true /* acquire */, false /* isSwappingDisplay */);
        if (!mDefaultDisplayPolicy.isScreenOnFully() && !mDefaultDisplayPolicy.isScreenOnEarly()) {
            updateScreenOffSleepToken(true /* acquire */);
        }

        if (mKeyguardDelegate != null) {
@@ -5661,9 +5660,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        if (DEBUG_WAKEUP) Slog.i(TAG, "Display" + displayId + " turned off...");

        if (displayId == DEFAULT_DISPLAY) {
            if (!isSwappingDisplay || mIsGoingToSleepDefaultDisplay
                    || !com.android.window.flags.Flags.skipSleepingWhenSwitchingDisplay()) {
                updateScreenOffSleepToken(true /* acquire */, isSwappingDisplay);
            if (!isSwappingDisplay || mIsGoingToSleepDefaultDisplay) {
                updateScreenOffSleepToken(true /* acquire */);
            }
            mRequestedOrSleepingDefaultDisplay = false;
            mDefaultDisplayPolicy.screenTurnedOff();
@@ -5722,7 +5720,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        if (displayId == DEFAULT_DISPLAY) {
            Trace.asyncTraceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "screenTurningOn",
                    0 /* cookie */);
            updateScreenOffSleepToken(false /* acquire */, false /* isSwappingDisplay */);
            updateScreenOffSleepToken(false /* acquire */);
            mDefaultDisplayPolicy.screenTurningOn(screenOnListener);
            mBootAnimationDismissable = false;

@@ -6228,9 +6226,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }

    // TODO (multidisplay): Support multiple displays in WindowManagerPolicy.
    private void updateScreenOffSleepToken(boolean acquire, boolean isSwappingDisplay) {
    private void updateScreenOffSleepToken(boolean acquire) {
        if (acquire) {
            mScreenOffSleepTokenAcquirer.acquire(DEFAULT_DISPLAY, isSwappingDisplay);
            mScreenOffSleepTokenAcquirer.acquire(DEFAULT_DISPLAY);
        } else {
            mScreenOffSleepTokenAcquirer.release(DEFAULT_DISPLAY);
        }
+0 −10
Original line number Diff line number Diff line
@@ -8998,16 +8998,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        return inTransitionSelfOrParent();
    }
    boolean isDisplaySleepingAndSwapping() {
        for (int i = mDisplayContent.mAllSleepTokens.size() - 1; i >= 0; i--) {
            RootWindowContainer.SleepToken sleepToken = mDisplayContent.mAllSleepTokens.get(i);
            if (sleepToken.isDisplaySwapping()) {
                return true;
            }
        }
        return false;
    }
    /**
     * Whether this activity is letterboxed for fixed orientation. If letterboxed due to fixed
     * orientation then aspect ratio restrictions are also already respected.
+0 −7
Original line number Diff line number Diff line
@@ -144,13 +144,6 @@ public abstract class ActivityTaskManagerInternal {
         */
        void acquire(int displayId);

        /**
         * Acquires a sleep token.
         * @param displayId The display to apply to.
         * @param isSwappingDisplay Whether the display is swapping to another physical display.
         */
        void acquire(int displayId, boolean isSwappingDisplay);

        /**
         * Releases the sleep token.
         * @param displayId The display to apply to.
+1 −7
Original line number Diff line number Diff line
@@ -5056,16 +5056,10 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {

        @Override
        public void acquire(int displayId) {
            acquire(displayId, false /* isSwappingDisplay */);
        }

        @Override
        public void acquire(int displayId, boolean isSwappingDisplay) {
            synchronized (mGlobalLock) {
                if (!mSleepTokens.contains(displayId)) {
                    mSleepTokens.append(displayId,
                            mRootWindowContainer.createSleepToken(mTag, displayId,
                                    isSwappingDisplay));
                            mRootWindowContainer.createSleepToken(mTag, displayId));
                    updateSleepIfNeededLocked();
                }
            }
Loading