Loading services/core/java/com/android/server/wm/DisplayContent.java +4 −3 Original line number Diff line number Diff line Loading @@ -6519,10 +6519,11 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } /** * @return whether the physical display has a fixed orientation and cannot be rotated. * @return whether the physical display orientation should change when its content rotates to * match the orientation of the content. */ boolean isDisplayOrientationFixed() { return (mDisplayInfo.flags & Display.FLAG_ROTATES_WITH_CONTENT) == 0; boolean shouldRotateWithContent() { return (mDisplayInfo.flags & Display.FLAG_ROTATES_WITH_CONTENT) != 0; } /** Loading services/core/java/com/android/server/wm/DisplayRotation.java +1 −1 Original line number Diff line number Diff line Loading @@ -435,7 +435,7 @@ public class DisplayRotation { PackageManager.FEATURE_LEANBACK); mDefaultFixedToUserRotation = (isCar || isTv || mService.mIsPc || mDisplayContent.forceDesktopMode() || mDisplayContent.isDisplayOrientationFixed()) || !mDisplayContent.shouldRotateWithContent()) // For debug purposes the next line turns this feature off with: // $ adb shell setprop config.override_forced_orient true // $ adb shell wm size reset Loading services/tests/wmtests/src/com/android/server/wm/DisplayRotationTests.java +4 −3 Original line number Diff line number Diff line Loading @@ -1194,12 +1194,12 @@ public class DisplayRotationTests { } @Test public void testIsFixedToUserRotation_displayContentOrientationFixed() throws Exception { public void testIsFixedToUserRotation_displayShouldNotRotateWithContent() throws Exception { mBuilder.build(); when(mMockDisplayContent.isDisplayOrientationFixed()).thenReturn(true); when(mMockDisplayContent.shouldRotateWithContent()).thenReturn(false); assertFalse("Display rotation should respect app requested orientation if" + " the display has fixed orientation.", mTarget.isFixedToUserRotation()); + " the display does not rotate with content.", mTarget.isFixedToUserRotation()); } @Test Loading Loading @@ -1453,6 +1453,7 @@ public class DisplayRotationTests { .thenReturn(mock(TaskDisplayArea.class)); when(mMockDisplayContent.getWindowConfiguration()) .thenReturn(new WindowConfiguration()); when(mMockDisplayContent.shouldRotateWithContent()).thenReturn(true); Field field = DisplayContent.class .getDeclaredField("mFixedRotationTransitionListener"); Loading Loading
services/core/java/com/android/server/wm/DisplayContent.java +4 −3 Original line number Diff line number Diff line Loading @@ -6519,10 +6519,11 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } /** * @return whether the physical display has a fixed orientation and cannot be rotated. * @return whether the physical display orientation should change when its content rotates to * match the orientation of the content. */ boolean isDisplayOrientationFixed() { return (mDisplayInfo.flags & Display.FLAG_ROTATES_WITH_CONTENT) == 0; boolean shouldRotateWithContent() { return (mDisplayInfo.flags & Display.FLAG_ROTATES_WITH_CONTENT) != 0; } /** Loading
services/core/java/com/android/server/wm/DisplayRotation.java +1 −1 Original line number Diff line number Diff line Loading @@ -435,7 +435,7 @@ public class DisplayRotation { PackageManager.FEATURE_LEANBACK); mDefaultFixedToUserRotation = (isCar || isTv || mService.mIsPc || mDisplayContent.forceDesktopMode() || mDisplayContent.isDisplayOrientationFixed()) || !mDisplayContent.shouldRotateWithContent()) // For debug purposes the next line turns this feature off with: // $ adb shell setprop config.override_forced_orient true // $ adb shell wm size reset Loading
services/tests/wmtests/src/com/android/server/wm/DisplayRotationTests.java +4 −3 Original line number Diff line number Diff line Loading @@ -1194,12 +1194,12 @@ public class DisplayRotationTests { } @Test public void testIsFixedToUserRotation_displayContentOrientationFixed() throws Exception { public void testIsFixedToUserRotation_displayShouldNotRotateWithContent() throws Exception { mBuilder.build(); when(mMockDisplayContent.isDisplayOrientationFixed()).thenReturn(true); when(mMockDisplayContent.shouldRotateWithContent()).thenReturn(false); assertFalse("Display rotation should respect app requested orientation if" + " the display has fixed orientation.", mTarget.isFixedToUserRotation()); + " the display does not rotate with content.", mTarget.isFixedToUserRotation()); } @Test Loading Loading @@ -1453,6 +1453,7 @@ public class DisplayRotationTests { .thenReturn(mock(TaskDisplayArea.class)); when(mMockDisplayContent.getWindowConfiguration()) .thenReturn(new WindowConfiguration()); when(mMockDisplayContent.shouldRotateWithContent()).thenReturn(true); Field field = DisplayContent.class .getDeclaredField("mFixedRotationTransitionListener"); Loading