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

Commit 8185cfae authored by Ikram Gabiyev's avatar Ikram Gabiyev
Browse files

Only mark queued transition as no-op if Shell-init

We have been marking some queued transitions as
mShouldNoopUponDequeue=true if they were coming in
while a display changing transition was collecting but hasn't started.
We were doing this because Shell wasn't aware of the new display state
yet.

This, however, does not apply to Core-initiated transitions, as they are
fully aware of the latest WM state; so this is just a Core <-> Shell
serialization issue.

Hence, we should limit the no-op-ing only to transitions directly
initiated by Shell through WindowOrganizerController.

Bug: 436919678
Flag: EXEMPT bugfix
Test: atest CtsWindowManagerDeviceDisplay:AppConfigurationTests
  #testTaskMoveToBackOrientation
Change-Id: I66ff1a11176c88327536e1b9d1b61be3af333890
parent 46ee9116
Loading
Loading
Loading
Loading
+20 −8
Original line number Diff line number Diff line
@@ -1559,13 +1559,14 @@ class TransitionController {
        proto.end(token);
    }

    /** Returns {@code true} if it started collecting, {@code false} if it was queued. */
    private void queueTransition(Transition transit, OnStartCollect onStartCollect) {
    private void queueTransition(Transition transit, OnStartCollect onStartCollect,
            boolean noopIfDuringDisplayChange) {
        final QueuedTransition queuedTransition = new QueuedTransition(transit, onStartCollect);

        // If we queue a non-display transition while a collecting transition is still not
        // formally started, then check if collecting transition is changing a display
        if ((transit.getFlags() & TRANSIT_FLAG_DISPLAY_LEVEL_TRANSITION) == 0
        // If we queue a non-display transition while a collecting transition
        // is still not formally started, then check if collecting transition is changing a display.
        if (noopIfDuringDisplayChange
                && (transit.getFlags() & TRANSIT_FLAG_DISPLAY_LEVEL_TRANSITION) == 0
                && mCollectingTransition != null && !mCollectingTransition.hasStarted()) {
            for (int i = 0; i < mCollectingTransition.mParticipants.size(); i++) {
                if (mCollectingTransition.mParticipants.valueAt(i).asDisplayContent() != null) {
@@ -1580,11 +1581,22 @@ class TransitionController {
                "Queueing transition: %s", transit);
    }

    /** Returns {@code true} if it started collecting, {@code false} if it was queued. */
    /** @see #startCollectOrQueue(Transition, OnStartCollect, boolean) */
    boolean startCollectOrQueue(Transition transit, OnStartCollect onStartCollect) {
        return startCollectOrQueue(transit, onStartCollect, false /* isDirectFromShell */);
    }

    /**
     * Returns {@code true} if it started collecting, {@code false} if it was queued.
     *
     * @param noopIfDuringDisplayChange true we should no-op this transition when a display
     *                                  changing transition is collecting but not formally started.
     */
    boolean startCollectOrQueue(Transition transit, OnStartCollect onStartCollect,
            boolean noopIfDuringDisplayChange) {
        if (!mQueuedTransitions.isEmpty()) {
            // Just add to queue since we already have a queue.
            queueTransition(transit, onStartCollect);
            queueTransition(transit, onStartCollect, noopIfDuringDisplayChange);
            return false;
        }
        if (mSyncEngine.hasActiveSync()) {
@@ -1603,7 +1615,7 @@ class TransitionController {
            } else {
                Slog.w(TAG, "Ongoing Sync outside of transition.");
            }
            queueTransition(transit, onStartCollect);
            queueTransition(transit, onStartCollect, noopIfDuringDisplayChange);
            return false;
        }
        moveToCollecting(transit);
+1 −1
Original line number Diff line number Diff line
@@ -379,7 +379,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                                    setAllReadyIfNeeded(nextTransition, wct);
                                }
                                mService.mChainTracker.end();
                            });
                            }, true /* noopIfDuringDisplayChange */);
                    return nextTransition.getToken();
                }
                // The transition already started collecting before sending a request to shell,