Loading services/core/java/com/android/server/wm/DisplayContent.java +2 −2 Original line number Diff line number Diff line Loading @@ -5664,10 +5664,10 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo * Return {@code true} if there is an ongoing animation to the "Recents" activity and this * activity as a fixed orientation so shouldn't be rotated. */ boolean isFixedOrientationRecentsAnimating() { boolean isTopFixedOrientationRecentsAnimating() { return mAnimatingRecents != null && mAnimatingRecents.getRequestedConfigurationOrientation() != ORIENTATION_UNDEFINED; != ORIENTATION_UNDEFINED && !hasTopFixedRotationLaunchingApp(); } @Override Loading services/core/java/com/android/server/wm/DisplayRotation.java +1 −1 Original line number Diff line number Diff line Loading @@ -432,7 +432,7 @@ public class DisplayRotation { } if (mDisplayContent.mFixedRotationTransitionListener .isFixedOrientationRecentsAnimating()) { .isTopFixedOrientationRecentsAnimating()) { // 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 // user rotating the device while the recents animation is running), we ignore Loading services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +11 −1 Original line number Diff line number Diff line Loading @@ -1236,18 +1236,28 @@ public class DisplayContentTests extends WindowTestsBase { public void testRecentsNotRotatingWithFixedRotation() { final DisplayRotation displayRotation = mDisplayContent.getDisplayRotation(); doCallRealMethod().when(displayRotation).updateRotationUnchecked(anyBoolean()); doCallRealMethod().when(displayRotation).updateOrientation(anyInt(), anyBoolean()); // Skip freezing so the unrelated conditions in updateRotationUnchecked won't disturb. doNothing().when(mWm).startFreezingDisplay(anyInt(), anyInt(), any(), anyInt()); final ActivityRecord recentsActivity = createActivityRecord(mDisplayContent, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_RECENTS); recentsActivity.setRequestedOrientation(SCREEN_ORIENTATION_PORTRAIT); // Do not rotate if the recents animation is animating on top. mDisplayContent.mFixedRotationTransitionListener.onStartRecentsAnimation(recentsActivity); displayRotation.setRotation((displayRotation.getRotation() + 1) % 4); assertFalse(displayRotation.updateRotationUnchecked(false)); // Rotation can be updated if the recents animation is finished. mDisplayContent.mFixedRotationTransitionListener.onFinishRecentsAnimation(false); assertTrue(displayRotation.updateRotationUnchecked(false)); // 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. mDisplayContent.mFixedRotationTransitionListener.onStartRecentsAnimation(recentsActivity); mDisplayContent.setFixedRotationLaunchingAppUnchecked(mAppWindow.mActivityRecord); displayRotation.setRotation((displayRotation.getRotation() + 1) % 4); assertTrue(displayRotation.updateRotationUnchecked(false)); } @Test Loading Loading
services/core/java/com/android/server/wm/DisplayContent.java +2 −2 Original line number Diff line number Diff line Loading @@ -5664,10 +5664,10 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo * Return {@code true} if there is an ongoing animation to the "Recents" activity and this * activity as a fixed orientation so shouldn't be rotated. */ boolean isFixedOrientationRecentsAnimating() { boolean isTopFixedOrientationRecentsAnimating() { return mAnimatingRecents != null && mAnimatingRecents.getRequestedConfigurationOrientation() != ORIENTATION_UNDEFINED; != ORIENTATION_UNDEFINED && !hasTopFixedRotationLaunchingApp(); } @Override Loading
services/core/java/com/android/server/wm/DisplayRotation.java +1 −1 Original line number Diff line number Diff line Loading @@ -432,7 +432,7 @@ public class DisplayRotation { } if (mDisplayContent.mFixedRotationTransitionListener .isFixedOrientationRecentsAnimating()) { .isTopFixedOrientationRecentsAnimating()) { // 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 // user rotating the device while the recents animation is running), we ignore Loading
services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +11 −1 Original line number Diff line number Diff line Loading @@ -1236,18 +1236,28 @@ public class DisplayContentTests extends WindowTestsBase { public void testRecentsNotRotatingWithFixedRotation() { final DisplayRotation displayRotation = mDisplayContent.getDisplayRotation(); doCallRealMethod().when(displayRotation).updateRotationUnchecked(anyBoolean()); doCallRealMethod().when(displayRotation).updateOrientation(anyInt(), anyBoolean()); // Skip freezing so the unrelated conditions in updateRotationUnchecked won't disturb. doNothing().when(mWm).startFreezingDisplay(anyInt(), anyInt(), any(), anyInt()); final ActivityRecord recentsActivity = createActivityRecord(mDisplayContent, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_RECENTS); recentsActivity.setRequestedOrientation(SCREEN_ORIENTATION_PORTRAIT); // Do not rotate if the recents animation is animating on top. mDisplayContent.mFixedRotationTransitionListener.onStartRecentsAnimation(recentsActivity); displayRotation.setRotation((displayRotation.getRotation() + 1) % 4); assertFalse(displayRotation.updateRotationUnchecked(false)); // Rotation can be updated if the recents animation is finished. mDisplayContent.mFixedRotationTransitionListener.onFinishRecentsAnimation(false); assertTrue(displayRotation.updateRotationUnchecked(false)); // 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. mDisplayContent.mFixedRotationTransitionListener.onStartRecentsAnimation(recentsActivity); mDisplayContent.setFixedRotationLaunchingAppUnchecked(mAppWindow.mActivityRecord); displayRotation.setRotation((displayRotation.getRotation() + 1) % 4); assertTrue(displayRotation.updateRotationUnchecked(false)); } @Test Loading