Fix recents transitions
- Also animate when there is no thumbnail, which can frequently
happen after exiting multi-window.
- Also animate when the target stack id is INVALID, because we
currently don't persist stack id's in the tasks.
Change-Id: I280c85e62f55d712408a3e77c43f665acb19bc4c
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index dd73261..7771139 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -581,8 +581,12 @@
* the task to the specified stack.
*/
public static boolean useAnimationSpecForAppTransition(int stackId) {
+
+ // TODO: INVALID_STACK_ID is also animated because we don't persist stack id's across
+ // reboots.
return stackId == FREEFORM_WORKSPACE_STACK_ID
- || stackId == FULLSCREEN_WORKSPACE_STACK_ID || stackId == DOCKED_STACK_ID;
+ || stackId == FULLSCREEN_WORKSPACE_STACK_ID || stackId == DOCKED_STACK_ID
+ || stackId == INVALID_STACK_ID;
}
/** Returns true if the windows in the stack can receive input keys. */
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsTransitionHelper.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsTransitionHelper.java
index 6c1ff9b..37b2859 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsTransitionHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsTransitionHelper.java
@@ -49,6 +49,7 @@
import java.util.ArrayList;
import java.util.List;
+import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
@@ -99,8 +100,7 @@
final ActivityOptions.OnAnimationStartedListener animStartedListener;
final IAppTransitionAnimationSpecsFuture transitionFuture;
- if (task.thumbnail != null && task.thumbnail.getWidth() > 0 &&
- task.thumbnail.getHeight() > 0) {
+ if (taskView != null) {
transitionFuture = getAppTransitionFuture(task, stackView, destinationStack);
animStartedListener = new ActivityOptions.OnAnimationStartedListener() {
@Override
@@ -266,7 +266,11 @@
// If this is a full screen stack, the transition will be towards the single, full screen
// task. We only need the transition spec for this task.
List<AppTransitionAnimationSpec> specs = new ArrayList<>();
- if (targetStackId == FULLSCREEN_WORKSPACE_STACK_ID) {
+
+ // TODO: Sometimes targetStackId is not initialized after reboot, so we also have to
+ // check for INVALID_STACK_ID
+ if (targetStackId == FULLSCREEN_WORKSPACE_STACK_ID || targetStackId == DOCKED_STACK_ID
+ || targetStackId == INVALID_STACK_ID) {
if (taskView == null) {
specs.add(composeOffscreenAnimationSpec(task, offscreenTaskRect));
} else {