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

Commit cecf424d authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Fix task animations

Sometimes apps are using trampoline activities in the current
task, and then open a new task from that trampoline activity,
which means that the first transition was ACTIVITY_OPEN and that's
what we take at end.

To fix this, we let task animations always override activity
animations.

Test: go/wm-smoke
Test: Open a Docs document from Drive. Open a Chrome link from
Maps.
Fixes: 72710883

Change-Id: I72b6901fdc21514ffca4a47e433d66ea9d3cdb32
parent 78cab5a5
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import static android.view.WindowManager.TRANSIT_KEYGUARD_OCCLUDE;
import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;
import static android.view.WindowManager.TRANSIT_NONE;
import static android.view.WindowManager.TRANSIT_TASK_CLOSE;
import static android.view.WindowManager.TRANSIT_TASK_IN_PLACE;
import static android.view.WindowManager.TRANSIT_TASK_OPEN;
import static android.view.WindowManager.TRANSIT_TASK_OPEN_BEHIND;
import static android.view.WindowManager.TRANSIT_TASK_TO_BACK;
@@ -2138,6 +2139,10 @@ public class AppTransition implements Dump {
                    && isTransitionEqual(TRANSIT_ACTIVITY_CLOSE)) {
                // Opening a new activity always supersedes a close for the anim.
                setAppTransition(transit, flags);
            } else if (isTaskTransit(transit) && isActivityTransit(mNextAppTransition)) {
                // Task animations always supersede activity animations, because if we have both, it
                // usually means that activity transition were just trampoline activities.
                setAppTransition(transit, flags);
            }
        }
        boolean prepared = prepare();
@@ -2162,6 +2167,21 @@ public class AppTransition implements Dump {
                || transit == TRANSIT_KEYGUARD_UNOCCLUDE;
    }

    private static boolean isTaskTransit(int transit) {
        return transit == TRANSIT_TASK_OPEN
                || transit == TRANSIT_TASK_CLOSE
                || transit == TRANSIT_TASK_OPEN_BEHIND
                || transit == TRANSIT_TASK_TO_BACK
                || transit == TRANSIT_TASK_TO_FRONT
                || transit == TRANSIT_TASK_IN_PLACE;
    }

    private static boolean isActivityTransit(int transit) {
        return transit == TRANSIT_ACTIVITY_OPEN
                || transit == TRANSIT_ACTIVITY_CLOSE
                || transit == TRANSIT_ACTIVITY_RELAUNCH;
    }

    /**
     * @return whether the transition should show the thumbnail being scaled down.
     */