Merge "Update rotation with animating recents if the device will sleep" into sc-qpr1-dev am: 2e2e4b3ac4 am: 42ec3d962c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15837570

Change-Id: Id8d31e938cb1544d6963c0da69446436f3367f83
This commit is contained in:
TreeHugger Robot
2021-09-17 06:17:24 +00:00
committed by Automerger Merge Worker
2 changed files with 9 additions and 1 deletions

View File

@@ -444,7 +444,9 @@ public class DisplayRotation {
} }
if (mDisplayContent.mFixedRotationTransitionListener if (mDisplayContent.mFixedRotationTransitionListener
.isTopFixedOrientationRecentsAnimating()) { .isTopFixedOrientationRecentsAnimating()
// If screen is off or the device is going to sleep, then still allow to update.
&& mService.mPolicy.okToAnimate(false /* ignoreScreenOn */)) {
// During the recents animation, the closing app might still be considered on top. // During the recents animation, the closing app might still be considered on top.
// In order to ignore its requested orientation to avoid a sensor led rotation (e.g // In order to ignore its requested orientation to avoid a sensor led rotation (e.g
// user rotating the device while the recents animation is running), we ignore // user rotating the device while the recents animation is running), we ignore

View File

@@ -1572,6 +1572,12 @@ public class DisplayContentTests extends WindowTestsBase {
mDisplayContent.mFixedRotationTransitionListener.onFinishRecentsAnimation(); mDisplayContent.mFixedRotationTransitionListener.onFinishRecentsAnimation();
assertTrue(displayRotation.updateRotationUnchecked(false)); assertTrue(displayRotation.updateRotationUnchecked(false));
// Rotation can be updated if the policy is not ok to animate (e.g. going to sleep).
mDisplayContent.mFixedRotationTransitionListener.onStartRecentsAnimation(recentsActivity);
displayRotation.setRotation((displayRotation.getRotation() + 1) % 4);
((TestWindowManagerPolicy) mWm.mPolicy).mOkToAnimate = false;
assertTrue(displayRotation.updateRotationUnchecked(false));
// Rotation can be updated if the recents animation is animating but it is not on top, e.g. // Rotation can be updated if the recents animation is animating but it is not on top, e.g.
// switching activities in different orientations by quickstep gesture. // switching activities in different orientations by quickstep gesture.
mDisplayContent.mFixedRotationTransitionListener.onStartRecentsAnimation(recentsActivity); mDisplayContent.mFixedRotationTransitionListener.onStartRecentsAnimation(recentsActivity);