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
diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java
index 0d36145..f0ca2ef 100644
--- a/services/core/java/com/android/server/wm/AppTransition.java
+++ b/services/core/java/com/android/server/wm/AppTransition.java
@@ -29,6 +29,7 @@
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 @@
&& 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 @@
|| 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.
*/