From 870927314e29d7428e34b9e35c5c1a364582c2df Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Wed, 1 Mar 2023 15:40:20 +0800 Subject: [PATCH] Preempt recents animation if display is changed This aligns the same behavior as [1]. Then the recents animation can be finished, and the animating activity can be stopped with a screenshot as the replacement. So the default rotation transition animation can continue to play. [1]:I41278e78b491c4b956e49b8b1fea40b470252aab Bug: 271099935 Test: Enable rotation for launcher. Launch app and rotate to landscape and enter recents. Rotate to portrait. There should be a normal rotation animation Change-Id: Ieb9ccb13ad0b4bdad880c4c90388cdd75affef34 --- .../systemui/shared/system/RemoteTransitionCompat.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java index 2a37bd370b7ca..488a675d5ca20 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java @@ -219,6 +219,13 @@ public class RemoteTransitionCompat { foundRecentsClosing = true; } } else if (change.getMode() == TRANSIT_CHANGE) { + // Finish recents animation if the display is changed, so the default + // transition handler can play the animation such as rotation effect. + if (change.hasFlags(TransitionInfo.FLAG_IS_DISPLAY)) { + mListener.onSwitchToScreenshot(() -> finish(false /* toHome */, + false /* userLeaveHint */)); + return false; + } hasChangingApp = true; } }