Loading services/core/java/com/android/server/wm/DisplayRotation.java +4 −6 Original line number Diff line number Diff line Loading @@ -558,16 +558,14 @@ public class DisplayRotation { @VisibleForTesting boolean shouldRotateSeamlessly(int oldRotation, int newRotation, boolean forceUpdate) { final WindowState w = mDisplayPolicy.getTopFullscreenOpaqueWindow(); if (w == null) { return false; } // Display doesn't need to be frozen because application has been started in correct // rotation already, so the rest of the windows can use seamless rotation. if (w.mToken.hasFixedRotationTransform()) { if (mDisplayContent.mFixedRotationLaunchingApp != null) { return true; } if (w != mDisplayContent.mCurrentFocus) { final WindowState w = mDisplayPolicy.getTopFullscreenOpaqueWindow(); if (w == null || w != mDisplayContent.mCurrentFocus) { return false; } // We only enable seamless rotation if the top window has requested it and is in the Loading services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +10 −4 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static android.view.Display.DEFAULT_DISPLAY; import static android.view.DisplayCutout.BOUNDS_POSITION_LEFT; import static android.view.DisplayCutout.BOUNDS_POSITION_TOP; import static android.view.DisplayCutout.fromBoundingRect; import static android.view.Surface.ROTATION_0; import static android.view.Surface.ROTATION_90; import static android.view.View.SYSTEM_UI_FLAG_FULLSCREEN; import static android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; Loading Loading @@ -998,12 +999,10 @@ public class DisplayContentTests extends WindowTestsBase { public void testApplyTopFixedRotationTransform() { mWm.mIsFixedRotationTransformEnabled = true; final Configuration config90 = new Configuration(); mDisplayContent.getDisplayRotation().setRotation(ROTATION_90); mDisplayContent.computeScreenConfiguration(config90); mDisplayContent.onRequestedOverrideConfigurationChanged(config90); mDisplayContent.computeScreenConfiguration(config90, ROTATION_90); final Configuration config = new Configuration(); mDisplayContent.getDisplayRotation().setRotation(Surface.ROTATION_0); mDisplayContent.getDisplayRotation().setRotation(ROTATION_0); mDisplayContent.computeScreenConfiguration(config); mDisplayContent.onRequestedOverrideConfigurationChanged(config); Loading @@ -1014,11 +1013,18 @@ public class DisplayContentTests extends WindowTestsBase { app.setRequestedOrientation(SCREEN_ORIENTATION_LANDSCAPE); assertTrue(app.isFixedRotationTransforming()); assertTrue(mDisplayContent.getDisplayRotation().shouldRotateSeamlessly( ROTATION_0 /* oldRotation */, ROTATION_90 /* newRotation */, false /* forceUpdate */)); // The display should keep current orientation and the rotated configuration should apply // to the activity. assertEquals(config.orientation, mDisplayContent.getConfiguration().orientation); assertEquals(config90.orientation, app.getConfiguration().orientation); assertEquals(config90.windowConfiguration.getBounds(), app.getBounds()); mDisplayContent.mAppTransition.notifyAppTransitionFinishedLocked(app.token); // The display should be rotated after the launch is finished. assertFalse(app.hasFixedRotationTransform()); assertEquals(config90.orientation, mDisplayContent.getConfiguration().orientation); } Loading Loading
services/core/java/com/android/server/wm/DisplayRotation.java +4 −6 Original line number Diff line number Diff line Loading @@ -558,16 +558,14 @@ public class DisplayRotation { @VisibleForTesting boolean shouldRotateSeamlessly(int oldRotation, int newRotation, boolean forceUpdate) { final WindowState w = mDisplayPolicy.getTopFullscreenOpaqueWindow(); if (w == null) { return false; } // Display doesn't need to be frozen because application has been started in correct // rotation already, so the rest of the windows can use seamless rotation. if (w.mToken.hasFixedRotationTransform()) { if (mDisplayContent.mFixedRotationLaunchingApp != null) { return true; } if (w != mDisplayContent.mCurrentFocus) { final WindowState w = mDisplayPolicy.getTopFullscreenOpaqueWindow(); if (w == null || w != mDisplayContent.mCurrentFocus) { return false; } // We only enable seamless rotation if the top window has requested it and is in the Loading
services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +10 −4 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static android.view.Display.DEFAULT_DISPLAY; import static android.view.DisplayCutout.BOUNDS_POSITION_LEFT; import static android.view.DisplayCutout.BOUNDS_POSITION_TOP; import static android.view.DisplayCutout.fromBoundingRect; import static android.view.Surface.ROTATION_0; import static android.view.Surface.ROTATION_90; import static android.view.View.SYSTEM_UI_FLAG_FULLSCREEN; import static android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; Loading Loading @@ -998,12 +999,10 @@ public class DisplayContentTests extends WindowTestsBase { public void testApplyTopFixedRotationTransform() { mWm.mIsFixedRotationTransformEnabled = true; final Configuration config90 = new Configuration(); mDisplayContent.getDisplayRotation().setRotation(ROTATION_90); mDisplayContent.computeScreenConfiguration(config90); mDisplayContent.onRequestedOverrideConfigurationChanged(config90); mDisplayContent.computeScreenConfiguration(config90, ROTATION_90); final Configuration config = new Configuration(); mDisplayContent.getDisplayRotation().setRotation(Surface.ROTATION_0); mDisplayContent.getDisplayRotation().setRotation(ROTATION_0); mDisplayContent.computeScreenConfiguration(config); mDisplayContent.onRequestedOverrideConfigurationChanged(config); Loading @@ -1014,11 +1013,18 @@ public class DisplayContentTests extends WindowTestsBase { app.setRequestedOrientation(SCREEN_ORIENTATION_LANDSCAPE); assertTrue(app.isFixedRotationTransforming()); assertTrue(mDisplayContent.getDisplayRotation().shouldRotateSeamlessly( ROTATION_0 /* oldRotation */, ROTATION_90 /* newRotation */, false /* forceUpdate */)); // The display should keep current orientation and the rotated configuration should apply // to the activity. assertEquals(config.orientation, mDisplayContent.getConfiguration().orientation); assertEquals(config90.orientation, app.getConfiguration().orientation); assertEquals(config90.windowConfiguration.getBounds(), app.getBounds()); mDisplayContent.mAppTransition.notifyAppTransitionFinishedLocked(app.token); // The display should be rotated after the launch is finished. assertFalse(app.hasFixedRotationTransform()); assertEquals(config90.orientation, mDisplayContent.getConfiguration().orientation); } Loading