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

Commit 1bd15850 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Only update latest surface visibility for transition participants

TransitionController#finishTransition invokes
ensureParticipantSurfaceVisibility, so when the playing transition
is finished, the surface visibility of participants will still be
updated.

This avoids setting intermediate state when a transition is finished
and its participant is collected by next transition, and then the
next transition checks it as a no-op change, so the condition
isPlayingTarget is false when the transition plays.

Bug: 416124146
Flag: com.android.window.flags.respect_hierarchy_surface_visibility
Test: Swipe to enter pip from a multi-activities task.
      The original task won't disappear a frame occasionally.
Change-Id: I0dc1a0fa33cf8c1867221d997b7fd297dfdec12e
parent 27c41e49
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -479,6 +479,19 @@ class TransitionController {
        return false;
    }

    /**
     * Returns {@code true} if the `wc` is a participant of a playing transition even if it is not
     * the playing target, e.g. its {@link Transition.ChangeInfo#hasChanged()} is false.
     */
    boolean isParticipantOfPlayingTransition(@NonNull WindowContainer<?> wc) {
        for (int i = mPlayingTransitions.size() - 1; i >= 0; --i) {
            if (mPlayingTransitions.get(i).mParticipants.contains(wc)) {
                return true;
            }
        }
        return false;
    }

    /** Returns {@code true} if the finishing transition contains `wc`. */
    boolean inFinishingTransition(WindowContainer<?> wc) {
        return mFinishingTransition != null && mFinishingTransition.isInTransition(wc);
+5 −0
Original line number Diff line number Diff line
@@ -302,6 +302,11 @@ public class WindowAnimator {
            // Let the transition handle surface visibility.
            return;
        }
        if (controller.isParticipantOfPlayingTransition(wc)) {
            // Non-target participants will still be updated when the transition is finished, so
            // skip the intermediate state.
            return;
        }
        wc.updateSurfaceVisibility(mTransaction);
    }