Suppress transition when mCancelWithDeferredScreenshot as true.
Sometimes, back transition is being suppressed when pressing back key to back
previous task.
It seems that a home transition is active at this point, which suppresses the
activity animation.
If home transition is animate during RecentAnimation invoked, which will suppress
activity animation in AppWindowToken#shouldAnimation, this does not make sense.
Add mCancelWithDeferredScreenshot check to only suppress animation when canceling
recents animation with screenshot case to fix above case.
Bug: 129934735
Test: manual as below steps:
1. Have 2 button navigation enabled.
2. Go to Google News
3. Open article
4. Press back
5. Expect the back transition should not be suppressed.
Test: atest RecentsAnimationControllerTest
Change-Id: Id59b87fb7438b2bc9f4bf33e3009e726fce82562
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 2321898..a3cef7f 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -2432,14 +2432,19 @@
}
}
- private boolean shouldAnimate(int transit) {
+
+ @VisibleForTesting
+ boolean shouldAnimate(int transit) {
final boolean isSplitScreenPrimary =
getWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
final boolean allowSplitScreenPrimaryAnimation = transit != TRANSIT_WALLPAPER_OPEN;
- // Don't animate when the task runs recents animation.
+ // Don't animate while the task runs recents animation but only if we are in the mode
+ // where we cancel with deferred screenshot, which means that the controller has
+ // transformed the task.
final RecentsAnimationController controller = mWmService.getRecentsAnimationController();
- if (controller != null && controller.isAnimatingTask(getTask())) {
+ if (controller != null && controller.isAnimatingTask(getTask())
+ && controller.shouldCancelWithDeferredScreenshot()) {
return false;
}