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

Commit 18bc6e82 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Polish a weird transition that open animation can apply on non-top task." into main

parents a1531cf7 262fe527
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -655,8 +655,10 @@ public class Transitions implements RemoteCallable<Transitions>,
            }
            if (change.hasFlags(FLAG_NO_ANIMATION)) {
                hasNoAnimation = true;
            } else {
                // at-least one relevant participant *is* animated, so we need to animate.
            } else if (!TransitionUtil.isOrderOnly(change) && !change.hasFlags(FLAG_IS_OCCLUDED)) {
                // Ignore the order only or occluded changes since they shouldn't be visible during
                // animation. For anything else, we need to animate if at-least one relevant
                // participant *is* animated,
                return false;
            }
        }
+18 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY;
import static android.window.TransitionInfo.FLAG_IS_BEHIND_STARTING_WINDOW;
import static android.window.TransitionInfo.FLAG_IS_DISPLAY;
import static android.window.TransitionInfo.FLAG_IS_INPUT_METHOD;
import static android.window.TransitionInfo.FLAG_IS_OCCLUDED;
import static android.window.TransitionInfo.FLAG_IS_VOICE_INTERACTION;
import static android.window.TransitionInfo.FLAG_IS_WALLPAPER;
import static android.window.TransitionInfo.FLAG_MOVED_TO_TOP;
@@ -2735,6 +2736,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
            out.setAnimationOptions(animOptionsForActivityTransition);
        }

        final ArraySet<WindowContainer> occludedAtEndContainers = new ArraySet<>();
        // Convert all the resolved ChangeInfos into TransactionInfo.Change objects in order.
        final int count = sortedTargets.size();
        for (int i = 0; i < count; ++i) {
@@ -2758,6 +2760,22 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
            info.mReadyFlags = change.getFlags();
            change.setDisplayId(info.mDisplayId, getDisplayId(target));

            // Add FLAGS_IS_OCCLUDED to preventing from visible-translucent change which belows
            // the non-translucent change playing unexpected open animation.
            if (change.getMode() == TRANSIT_TO_FRONT || change.getMode() == TRANSIT_OPEN) {
                for (int occIndex = occludedAtEndContainers.size() - 1; occIndex >= 0; --occIndex) {
                    if (target.isDescendantOf(occludedAtEndContainers.valueAt(occIndex))) {
                        change.setFlags(change.getFlags() | FLAG_IS_OCCLUDED);
                        break;
                    }
                }
            }
            if (!change.hasFlags(FLAG_TRANSLUCENT)  && (change.getMode() == TRANSIT_OPEN
                    || change.getMode() == TRANSIT_TO_FRONT
                    || change.getMode() == TRANSIT_CHANGE)) {
                occludedAtEndContainers.add(target.getParent());
            }

            final Task task = target.asTask();
            final TaskFragment taskFragment = target.asTaskFragment();
            final boolean isEmbeddedTaskFragment = taskFragment != null