Loading services/core/java/com/android/server/wm/ActivityRecord.java +1 −14 Original line number Diff line number Diff line Loading @@ -7984,20 +7984,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // orientation with insets applied. return; } // Not using Task#isResizeable() or ActivityRecord#isResizeable() directly because app // compatibility testing showed that android:supportsPictureInPicture="true" alone is not // sufficient signal for not letterboxing an app. // TODO(214602463): Remove multi-window check since orientation and aspect ratio // restrictions should always be applied in multi-window. final boolean isResizeable = task != null // Activity should be resizable if the task is. ? task.isResizeable(/* checkPictureInPictureSupport */ false) || isResizeable(/* checkPictureInPictureSupport */ false) : isResizeable(/* checkPictureInPictureSupport */ false); if (WindowConfiguration.inMultiWindowMode(windowingMode) && isResizeable) { // Ignore orientation request for resizable apps in multi window. return; } if (windowingMode == WINDOWING_MODE_PINNED) { // PiP bounds have higher priority than the requested orientation. Otherwise the // activity may be squeezed into a small piece. Loading services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +3 −4 Original line number Diff line number Diff line Loading @@ -611,10 +611,9 @@ public class ActivityRecordTests extends WindowTestsBase { activity.setRequestedOrientation(activityCurOrientation == ORIENTATION_LANDSCAPE ? SCREEN_ORIENTATION_PORTRAIT : SCREEN_ORIENTATION_LANDSCAPE); // Asserts fixed orientation request is ignored, and the orientation is not changed // (fill Task). assertEquals(activityCurOrientation, activity.getConfiguration().orientation); assertFalse(activity.isLetterboxedForFixedOrientationAndAspectRatio()); // Asserts fixed orientation request is not ignored, and the orientation is changed. assertNotEquals(activityCurOrientation, activity.getConfiguration().orientation); assertTrue(activity.isLetterboxedForFixedOrientationAndAspectRatio()); } @Test Loading services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +22 −0 Original line number Diff line number Diff line Loading @@ -1875,6 +1875,28 @@ public class SizeCompatTests extends WindowTestsBase { assertLetterboxSurfacesDrawnBetweenActivityAndParentBounds(organizer.mPrimary.getBounds()); } @Test public void testResizableFixedOrientationAppInSplitScreen_letterboxForDifferentOrientation() { setUpDisplaySizeWithApp(1000, 2800); final TestSplitOrganizer organizer = new TestSplitOrganizer(mAtm, mActivity.getDisplayContent()); // Resizable landscape-only activity. prepareLimitedBounds(mActivity, SCREEN_ORIENTATION_LANDSCAPE, /* isUnresizable= */ false); final Rect originalBounds = new Rect(mActivity.getBounds()); // Move activity to split screen which takes half of the screen. mTask.reparent(organizer.mPrimary, POSITION_TOP, /* moveParents= */ false , "test"); organizer.mPrimary.setBounds(0, 0, 1000, 1400); assertEquals(WINDOWING_MODE_MULTI_WINDOW, mTask.getWindowingMode()); assertEquals(WINDOWING_MODE_MULTI_WINDOW, mActivity.getWindowingMode()); // Resizable activity is not in size compat mode but in the letterbox for fixed orientation. assertFitted(); assertTrue(mActivity.isLetterboxedForFixedOrientationAndAspectRatio()); } @Test public void testSupportsNonResizableInSplitScreen_fillTaskForSameOrientation() { // Support non resizable in multi window Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +1 −14 Original line number Diff line number Diff line Loading @@ -7984,20 +7984,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // orientation with insets applied. return; } // Not using Task#isResizeable() or ActivityRecord#isResizeable() directly because app // compatibility testing showed that android:supportsPictureInPicture="true" alone is not // sufficient signal for not letterboxing an app. // TODO(214602463): Remove multi-window check since orientation and aspect ratio // restrictions should always be applied in multi-window. final boolean isResizeable = task != null // Activity should be resizable if the task is. ? task.isResizeable(/* checkPictureInPictureSupport */ false) || isResizeable(/* checkPictureInPictureSupport */ false) : isResizeable(/* checkPictureInPictureSupport */ false); if (WindowConfiguration.inMultiWindowMode(windowingMode) && isResizeable) { // Ignore orientation request for resizable apps in multi window. return; } if (windowingMode == WINDOWING_MODE_PINNED) { // PiP bounds have higher priority than the requested orientation. Otherwise the // activity may be squeezed into a small piece. Loading
services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +3 −4 Original line number Diff line number Diff line Loading @@ -611,10 +611,9 @@ public class ActivityRecordTests extends WindowTestsBase { activity.setRequestedOrientation(activityCurOrientation == ORIENTATION_LANDSCAPE ? SCREEN_ORIENTATION_PORTRAIT : SCREEN_ORIENTATION_LANDSCAPE); // Asserts fixed orientation request is ignored, and the orientation is not changed // (fill Task). assertEquals(activityCurOrientation, activity.getConfiguration().orientation); assertFalse(activity.isLetterboxedForFixedOrientationAndAspectRatio()); // Asserts fixed orientation request is not ignored, and the orientation is changed. assertNotEquals(activityCurOrientation, activity.getConfiguration().orientation); assertTrue(activity.isLetterboxedForFixedOrientationAndAspectRatio()); } @Test Loading
services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +22 −0 Original line number Diff line number Diff line Loading @@ -1875,6 +1875,28 @@ public class SizeCompatTests extends WindowTestsBase { assertLetterboxSurfacesDrawnBetweenActivityAndParentBounds(organizer.mPrimary.getBounds()); } @Test public void testResizableFixedOrientationAppInSplitScreen_letterboxForDifferentOrientation() { setUpDisplaySizeWithApp(1000, 2800); final TestSplitOrganizer organizer = new TestSplitOrganizer(mAtm, mActivity.getDisplayContent()); // Resizable landscape-only activity. prepareLimitedBounds(mActivity, SCREEN_ORIENTATION_LANDSCAPE, /* isUnresizable= */ false); final Rect originalBounds = new Rect(mActivity.getBounds()); // Move activity to split screen which takes half of the screen. mTask.reparent(organizer.mPrimary, POSITION_TOP, /* moveParents= */ false , "test"); organizer.mPrimary.setBounds(0, 0, 1000, 1400); assertEquals(WINDOWING_MODE_MULTI_WINDOW, mTask.getWindowingMode()); assertEquals(WINDOWING_MODE_MULTI_WINDOW, mActivity.getWindowingMode()); // Resizable activity is not in size compat mode but in the letterbox for fixed orientation. assertFitted(); assertTrue(mActivity.isLetterboxedForFixedOrientationAndAspectRatio()); } @Test public void testSupportsNonResizableInSplitScreen_fillTaskForSameOrientation() { // Support non resizable in multi window Loading