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

Commit f5993a5a authored by Jiaming Liu's avatar Jiaming Liu Committed by Android Build Coastguard Worker
Browse files

Drop TaskFragment Transitions if behind starting window

Animation is not needed if all the TF changes are behind the starting
window. Without this change, the transition is merged into the remote
transition, causing the latter being canceled.

Bug: 328775431
Test: Manually launch Settings app from Quick Settings
Flag: EXEMPT bugfix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:431087e3b66e4e1da86d5d36a556fcc5e55332d4)
Merged-In: I7c46209322c19763048ebfee91a633a8168cd81a
Change-Id: I7c46209322c19763048ebfee91a633a8168cd81a
parent d6e7d8e7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -205,7 +205,7 @@ public final class TransitionInfo implements Parcelable {
            FLAG_SYNC,
            FLAG_CONFIG_AT_END,
            FLAG_FIRST_CUSTOM
    })
    }, flag = true)
    public @interface ChangeFlags {}

    private final @TransitionType int mType;
+10 −7
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
import static android.view.WindowManager.fixScale;
import static android.window.TransitionInfo.FLAG_BACK_GESTURE_ANIMATED;
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_OCCLUDED;
import static android.window.TransitionInfo.FLAG_NO_ANIMATION;
@@ -788,14 +789,16 @@ public class Transitions implements RemoteCallable<Transitions>,
        final int changeSize = info.getChanges().size();
        boolean taskChange = false;
        boolean transferStartingWindow = false;
        int noAnimationBehindStartingWindow = 0;
        int animBehindStartingWindow = 0;
        boolean allOccluded = changeSize > 0;
        for (int i = changeSize - 1; i >= 0; --i) {
            final TransitionInfo.Change change = info.getChanges().get(i);
            taskChange |= change.getTaskInfo() != null;
            transferStartingWindow |= change.hasFlags(FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT);
            if (change.hasAllFlags(FLAG_IS_BEHIND_STARTING_WINDOW | FLAG_NO_ANIMATION)) {
                noAnimationBehindStartingWindow++;
            if (change.hasAllFlags(FLAG_IS_BEHIND_STARTING_WINDOW | FLAG_NO_ANIMATION)
                    || change.hasAllFlags(
                            FLAG_IS_BEHIND_STARTING_WINDOW | FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY)) {
                animBehindStartingWindow++;
            }
            if (!change.hasFlags(FLAG_IS_OCCLUDED)) {
                allOccluded = false;
@@ -813,11 +816,11 @@ public class Transitions implements RemoteCallable<Transitions>,
        // There does not need animation when:
        // A. Transfer starting window. Apply transfer starting window directly if there is no other
        // task change. Since this is an activity->activity situation, we can detect it by selecting
        // transitions with only 2 changes where
        // 1. neither are tasks, and
        // transitions with changes where
        // 1. none are tasks, and
        // 2. one is a starting-window recipient, or all change is behind starting window.
        if (!taskChange && (transferStartingWindow || noAnimationBehindStartingWindow == changeSize)
                && changeSize == 2
        if (!taskChange && (transferStartingWindow || animBehindStartingWindow == changeSize)
                && changeSize >= 1
                // B. It's visibility change if the TRANSIT_TO_BACK/TO_FRONT happened when all
                // changes are underneath another change.
                || ((info.getType() == TRANSIT_TO_BACK || info.getType() == TRANSIT_TO_FRONT)