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

Commit 9618134c authored by Evan Rosky's avatar Evan Rosky
Browse files

Just record initial task-order, don't collect the task

Since we are recording the order but don't yet know if the
task is expected to change. If we collect it without changing
it, it could end up waiting for a non-collected child to
report.

Bug: 276608270
Test: atest IncompleteMotionTest
Change-Id: I7ebf72e21c0844e42db8bb4944b62b0e31e062c4
parent bdb7f0b0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -305,8 +305,8 @@ class BLASTSyncEngine {
        if (mActiveSyncs.size() != 0) {
            // We currently only support one sync at a time, so start a new SyncGroup when there is
            // another may cause issue.
            ProtoLog.w(WM_DEBUG_SYNC_ENGINE,
                    "SyncGroup %d: Started when there is other active SyncGroup", s.mSyncId);
            Slog.e(TAG, "SyncGroup " + s.mSyncId
                    + ": Started when there is other active SyncGroup");
        }
        mActiveSyncs.put(s.mSyncId, s);
        ProtoLog.v(WM_DEBUG_SYNC_ENGINE, "SyncGroup %d: Started for listener: %s",
+1 −1
Original line number Diff line number Diff line
@@ -4687,7 +4687,7 @@ class Task extends TaskFragment {
        if (!isAttached()) {
            return;
        }
        mTransitionController.collect(this);
        mTransitionController.recordTaskOrder(this);

        final TaskDisplayArea taskDisplayArea = getDisplayArea();

+15 −4
Original line number Diff line number Diff line
@@ -520,10 +520,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
            mChanges.put(wc, info);
        }
        mParticipants.add(wc);
        if (wc.getDisplayContent() != null && !mTargetDisplays.contains(wc.getDisplayContent())) {
            mTargetDisplays.add(wc.getDisplayContent());
            addOnTopTasks(wc.getDisplayContent(), mOnTopTasksStart);
        }
        recordDisplay(wc.getDisplayContent());
        if (info.mShowWallpaper) {
            // Collect the wallpaper token (for isWallpaper(wc)) so it is part of the sync set.
            final WindowState wallpaper =
@@ -534,6 +531,20 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        }
    }

    private void recordDisplay(DisplayContent dc) {
        if (dc == null || mTargetDisplays.contains(dc)) return;
        mTargetDisplays.add(dc);
        addOnTopTasks(dc, mOnTopTasksStart);
    }

    /**
     * Records information about the initial task order. This does NOT collect anything. Call this
     * before any ordering changes *could* occur, but it is not known yet if it will occur.
     */
    void recordTaskOrder(WindowContainer from) {
        recordDisplay(from.getDisplayContent());
    }

    /** Adds the top non-alwaysOnTop tasks within `task` to `out`. */
    private static void addOnTopTasks(Task task, ArrayList<Task> out) {
        for (int i = task.getChildCount() - 1; i >= 0; --i) {
+6 −0
Original line number Diff line number Diff line
@@ -605,6 +605,12 @@ class TransitionController {
        mCollectingTransition.collectExistenceChange(wc);
    }

    /** @see Transition#recordTaskOrder */
    void recordTaskOrder(@NonNull WindowContainer wc) {
        if (mCollectingTransition == null) return;
        mCollectingTransition.recordTaskOrder(wc);
    }

    /**
     * Collects the window containers which need to be synced with the changing display area into
     * the current collecting transition.