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
This commit is contained in:
Riddle Hsu
2023-03-01 15:40:20 +08:00
parent dd218cbaf8
commit 870927314e

View File

@@ -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;
}
}