Do not run rotation animation when folding/unfolding

Disables screen freezing and rotation animation when
screen blocker is not removed (e.g. when folding or
unfoding a foldable device with two screens).

Fixes: 199897277
Test: manual fold/unfolds on foldable devices
Test: rotation animation works on inner/outer screen
Change-Id: I2b353b5cb31042cdf4789915a04510062231e29c
This commit is contained in:
Nick Chameyev
2021-10-15 15:10:06 +00:00
parent 6ba778585f
commit 6a0044a07c
2 changed files with 8 additions and 1 deletions

View File

@@ -5824,7 +5824,9 @@ public class WindowManagerService extends IWindowManager.Stub
return;
}
if (!displayContent.isReady() || !mPolicy.isScreenOn() || !displayContent.okToAnimate()) {
if (!displayContent.isReady() || !displayContent.getDisplayPolicy().isScreenOnFully()
|| displayContent.getDisplayInfo().state == Display.STATE_OFF
|| !displayContent.okToAnimate()) {
// No need to freeze the screen before the display is ready, if the screen is off,
// or we can't currently animate.
return;

View File

@@ -1751,6 +1751,11 @@ public class ActivityRecordTests extends WindowTestsBase {
anyInt() /* orientation */, anyInt() /* lastRotation */);
// Set to visible so the activity can freeze the screen.
activity.setVisibility(true);
// Update the display policy to make the screen fully turned on so the freeze is allowed
display.getDisplayPolicy().screenTurnedOn(null);
display.getDisplayPolicy().finishKeyguardDrawn();
display.getDisplayPolicy().finishWindowsDrawn();
display.getDisplayPolicy().finishScreenTurningOn();
display.rotateInDifferentOrientationIfNeeded(activity);
display.setFixedRotationLaunchingAppUnchecked(activity);