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

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

Clean up outdated path of sleep token for swapping display

Since commit 20e51039 was enabled from previous release, there no longer
has activity lifecycle changes when folding or unfolding the device.

The deferring of activity-stop in commit 0687f9d3 can be removed because
the case of isSwappingDisplay=true for updateScreenOffSleepToken is gone.

Bug: 163976519
Bug: 303241079
Flag: EXEMPT remove launched flag
Test: atest PhoneWindowManagerTests#testScreenTurnedOff

Change-Id: Ia991eab37793c159c7a1afb1276cf82ad6ad0462
parent 412f07e9
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
@@ -8932,16 +8932,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