Loading services/core/java/com/android/server/wm/LetterboxUiController.java +14 −23 Original line number Diff line number Diff line Loading @@ -885,13 +885,11 @@ final class LetterboxUiController { // Note that we check the task rather than the parent as with ActivityEmbedding the parent might // be a TaskFragment, and its windowing mode is always MULTI_WINDOW, even if the task is // actually fullscreen. private boolean isDisplayFullScreenAndInPosture(DeviceStateController.DeviceState state, boolean isTabletop) { private boolean isDisplayFullScreenAndInPosture(boolean isTabletop) { Task task = mActivityRecord.getTask(); return mActivityRecord.mDisplayContent != null && mActivityRecord.mDisplayContent.getDisplayRotation().isDeviceInPosture(state, isTabletop) && task != null return mActivityRecord.mDisplayContent != null && task != null && mActivityRecord.mDisplayContent.getDisplayRotation().isDeviceInPosture( DeviceStateController.DeviceState.HALF_FOLDED, isTabletop) && task.getWindowingMode() == WINDOWING_MODE_FULLSCREEN; } Loading Loading @@ -919,16 +917,14 @@ final class LetterboxUiController { } private boolean isFullScreenAndBookModeEnabled() { return isDisplayFullScreenAndInPosture( DeviceStateController.DeviceState.HALF_FOLDED, false /* isTabletop */) return isDisplayFullScreenAndInPosture(/* isTabletop */ false) && mLetterboxConfiguration.getIsAutomaticReachabilityInBookModeEnabled(); } float getVerticalPositionMultiplier(Configuration parentConfiguration) { // Don't check resolved configuration because it may not be updated yet during // configuration change. boolean tabletopMode = isDisplayFullScreenAndInPosture( DeviceStateController.DeviceState.HALF_FOLDED, true /* isTabletop */); boolean tabletopMode = isDisplayFullScreenAndInPosture(/* isTabletop */ true); return isVerticalReachabilityEnabled(parentConfiguration) // Using the last global dynamic position to avoid "jumps" when moving // between apps or activities. Loading Loading @@ -961,16 +957,15 @@ final class LetterboxUiController { } private boolean shouldUseSplitScreenAspectRatio(@NonNull Configuration parentConfiguration) { final boolean isBookMode = isDisplayFullScreenAndInPosture( DeviceStateController.DeviceState.HALF_FOLDED, /* isTabletop */ false); final boolean isBookMode = isDisplayFullScreenAndInPosture(/* isTabletop */ false); final boolean isNotCenteredHorizontally = getHorizontalPositionMultiplier( parentConfiguration) != LETTERBOX_POSITION_MULTIPLIER_CENTER; final boolean isTabletopMode = isDisplayFullScreenAndInPosture( DeviceStateController.DeviceState.HALF_FOLDED, /* isTabletop */ true); final boolean isTabletopMode = isDisplayFullScreenAndInPosture(/* isTabletop */ true); final boolean isLandscape = isFixedOrientationLandscape( mActivityRecord.getOverrideOrientation()); // Don't resize to split screen size when in book mode if letterbox position is centered return ((isBookMode && isNotCenteredHorizontally) || isTabletopMode) return (isBookMode && isNotCenteredHorizontally || isTabletopMode && isLandscape) || isCameraCompatSplitScreenAspectRatioAllowed() && isCameraCompatTreatmentActive(); } Loading Loading @@ -1632,17 +1627,13 @@ final class LetterboxUiController { if (isHorizontalReachabilityEnabled()) { int letterboxPositionForHorizontalReachability = getLetterboxConfiguration() .getLetterboxPositionForHorizontalReachability( isDisplayFullScreenAndInPosture( DeviceStateController.DeviceState.HALF_FOLDED, false /* isTabletop */)); isDisplayFullScreenAndInPosture(/* isTabletop */ false)); positionToLog = letterboxHorizontalReachabilityPositionToLetterboxPosition( letterboxPositionForHorizontalReachability); } else if (isVerticalReachabilityEnabled()) { int letterboxPositionForVerticalReachability = getLetterboxConfiguration() .getLetterboxPositionForVerticalReachability( isDisplayFullScreenAndInPosture( DeviceStateController.DeviceState.HALF_FOLDED, true /* isTabletop */)); isDisplayFullScreenAndInPosture(/* isTabletop */ true)); positionToLog = letterboxVerticalReachabilityPositionToLetterboxPosition( letterboxPositionForVerticalReachability); } Loading services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +15 −0 Original line number Diff line number Diff line Loading @@ -4424,6 +4424,21 @@ public class SizeCompatTests extends WindowTestsBase { assertEquals(expected, actual, DELTA_ASPECT_RATIO_TOLERANCE); } @Test public void testPortraitAppInTabletop_notSplitScreen() { final int dw = 2400; setUpDisplaySizeWithApp(dw, 2000); prepareUnresizable(mActivity, SCREEN_ORIENTATION_PORTRAIT); final int initialWidth = mActivity.getBounds().width(); setFoldablePosture(true /* isHalfFolded */, true /* isTabletop */); final int finalWidth = mActivity.getBounds().width(); assertEquals(initialWidth, finalWidth); assertNotEquals(finalWidth, getExpectedSplitSize(dw)); } @Test public void testUpdateResolvedBoundsHorizontalPosition_bookModeEnabled() { // Set up a display in landscape with a fixed-orientation PORTRAIT app Loading Loading
services/core/java/com/android/server/wm/LetterboxUiController.java +14 −23 Original line number Diff line number Diff line Loading @@ -885,13 +885,11 @@ final class LetterboxUiController { // Note that we check the task rather than the parent as with ActivityEmbedding the parent might // be a TaskFragment, and its windowing mode is always MULTI_WINDOW, even if the task is // actually fullscreen. private boolean isDisplayFullScreenAndInPosture(DeviceStateController.DeviceState state, boolean isTabletop) { private boolean isDisplayFullScreenAndInPosture(boolean isTabletop) { Task task = mActivityRecord.getTask(); return mActivityRecord.mDisplayContent != null && mActivityRecord.mDisplayContent.getDisplayRotation().isDeviceInPosture(state, isTabletop) && task != null return mActivityRecord.mDisplayContent != null && task != null && mActivityRecord.mDisplayContent.getDisplayRotation().isDeviceInPosture( DeviceStateController.DeviceState.HALF_FOLDED, isTabletop) && task.getWindowingMode() == WINDOWING_MODE_FULLSCREEN; } Loading Loading @@ -919,16 +917,14 @@ final class LetterboxUiController { } private boolean isFullScreenAndBookModeEnabled() { return isDisplayFullScreenAndInPosture( DeviceStateController.DeviceState.HALF_FOLDED, false /* isTabletop */) return isDisplayFullScreenAndInPosture(/* isTabletop */ false) && mLetterboxConfiguration.getIsAutomaticReachabilityInBookModeEnabled(); } float getVerticalPositionMultiplier(Configuration parentConfiguration) { // Don't check resolved configuration because it may not be updated yet during // configuration change. boolean tabletopMode = isDisplayFullScreenAndInPosture( DeviceStateController.DeviceState.HALF_FOLDED, true /* isTabletop */); boolean tabletopMode = isDisplayFullScreenAndInPosture(/* isTabletop */ true); return isVerticalReachabilityEnabled(parentConfiguration) // Using the last global dynamic position to avoid "jumps" when moving // between apps or activities. Loading Loading @@ -961,16 +957,15 @@ final class LetterboxUiController { } private boolean shouldUseSplitScreenAspectRatio(@NonNull Configuration parentConfiguration) { final boolean isBookMode = isDisplayFullScreenAndInPosture( DeviceStateController.DeviceState.HALF_FOLDED, /* isTabletop */ false); final boolean isBookMode = isDisplayFullScreenAndInPosture(/* isTabletop */ false); final boolean isNotCenteredHorizontally = getHorizontalPositionMultiplier( parentConfiguration) != LETTERBOX_POSITION_MULTIPLIER_CENTER; final boolean isTabletopMode = isDisplayFullScreenAndInPosture( DeviceStateController.DeviceState.HALF_FOLDED, /* isTabletop */ true); final boolean isTabletopMode = isDisplayFullScreenAndInPosture(/* isTabletop */ true); final boolean isLandscape = isFixedOrientationLandscape( mActivityRecord.getOverrideOrientation()); // Don't resize to split screen size when in book mode if letterbox position is centered return ((isBookMode && isNotCenteredHorizontally) || isTabletopMode) return (isBookMode && isNotCenteredHorizontally || isTabletopMode && isLandscape) || isCameraCompatSplitScreenAspectRatioAllowed() && isCameraCompatTreatmentActive(); } Loading Loading @@ -1632,17 +1627,13 @@ final class LetterboxUiController { if (isHorizontalReachabilityEnabled()) { int letterboxPositionForHorizontalReachability = getLetterboxConfiguration() .getLetterboxPositionForHorizontalReachability( isDisplayFullScreenAndInPosture( DeviceStateController.DeviceState.HALF_FOLDED, false /* isTabletop */)); isDisplayFullScreenAndInPosture(/* isTabletop */ false)); positionToLog = letterboxHorizontalReachabilityPositionToLetterboxPosition( letterboxPositionForHorizontalReachability); } else if (isVerticalReachabilityEnabled()) { int letterboxPositionForVerticalReachability = getLetterboxConfiguration() .getLetterboxPositionForVerticalReachability( isDisplayFullScreenAndInPosture( DeviceStateController.DeviceState.HALF_FOLDED, true /* isTabletop */)); isDisplayFullScreenAndInPosture(/* isTabletop */ true)); positionToLog = letterboxVerticalReachabilityPositionToLetterboxPosition( letterboxPositionForVerticalReachability); } Loading
services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +15 −0 Original line number Diff line number Diff line Loading @@ -4424,6 +4424,21 @@ public class SizeCompatTests extends WindowTestsBase { assertEquals(expected, actual, DELTA_ASPECT_RATIO_TOLERANCE); } @Test public void testPortraitAppInTabletop_notSplitScreen() { final int dw = 2400; setUpDisplaySizeWithApp(dw, 2000); prepareUnresizable(mActivity, SCREEN_ORIENTATION_PORTRAIT); final int initialWidth = mActivity.getBounds().width(); setFoldablePosture(true /* isHalfFolded */, true /* isTabletop */); final int finalWidth = mActivity.getBounds().width(); assertEquals(initialWidth, finalWidth); assertNotEquals(finalWidth, getExpectedSplitSize(dw)); } @Test public void testUpdateResolvedBoundsHorizontalPosition_bookModeEnabled() { // Set up a display in landscape with a fixed-orientation PORTRAIT app Loading