Loading services/core/java/com/android/server/wm/DesktopModeBoundsCalculator.java +5 −2 Original line number Diff line number Diff line Loading @@ -73,9 +73,12 @@ public final class DesktopModeBoundsCalculator { final Rect stableBounds = new Rect(); task.getDisplayArea().getStableRect(stableBounds); // If the options bounds size is flexible, update size with calculated desired size. final boolean hasFullscreenOverride = activity != null && activity.mAppCompatController.getAspectRatioOverrides().hasFullscreenOverride(); // If the options bounds size is flexible and no fullscreen override has been applied, // update size with calculated desired size. final boolean updateOptionBoundsSize = options != null && options.getFlexibleLaunchSize(); && options.getFlexibleLaunchSize() && !hasFullscreenOverride; // If cascading is also enabled, the position of the options bounds must be respected // during the size update. final boolean shouldRespectOptionPosition = Loading services/tests/wmtests/src/com/android/server/wm/DesktopModeLaunchParamsModifierTests.java +28 −2 Original line number Diff line number Diff line Loading @@ -383,7 +383,7 @@ public class DesktopModeLaunchParamsModifierTests extends spyOn(mActivity.mAppCompatController.getAspectRatioOverrides()); doReturn(true).when( mActivity.mAppCompatController.getAspectRatioOverrides()) .isUserFullscreenOverrideEnabled(); .hasFullscreenOverride(); final int desiredWidth = (int) (LANDSCAPE_DISPLAY_BOUNDS.width() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); Loading Loading @@ -411,7 +411,7 @@ public class DesktopModeLaunchParamsModifierTests extends spyOn(mActivity.mAppCompatController.getAspectRatioOverrides()); doReturn(true).when( mActivity.mAppCompatController.getAspectRatioOverrides()) .isSystemOverrideToFullscreenEnabled(); .hasFullscreenOverride(); final int desiredWidth = (int) (LANDSCAPE_DISPLAY_BOUNDS.width() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); Loading Loading @@ -1167,6 +1167,32 @@ public class DesktopModeLaunchParamsModifierTests extends assertEquals(WINDOWING_MODE_FREEFORM, mResult.mWindowingMode); } @Test @EnableFlags({Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE, Flags.FLAG_ENABLE_SHELL_INITIAL_BOUNDS_REGRESSION_BUG_FIX}) public void testOptionsBoundsSet_flexibleLaunchSizeWithFullscreenOverride_noModifications() { setupDesktopModeLaunchParamsModifier(); final TestDisplayContent display = createNewDisplayContent(WINDOWING_MODE_FULLSCREEN); final Task task = new TaskBuilder(mSupervisor).setActivityType( ACTIVITY_TYPE_STANDARD).setDisplay(display).build(); final ActivityOptions options = ActivityOptions.makeBasic() .setLaunchBounds(new Rect( DISPLAY_STABLE_BOUNDS.left, DISPLAY_STABLE_BOUNDS.top, /* right = */ 500, /* bottom = */ 500)) .setFlexibleLaunchSize(true); spyOn(mActivity.mAppCompatController.getAspectRatioOverrides()); doReturn(true).when( mActivity.mAppCompatController.getAspectRatioOverrides()) .hasFullscreenOverride(); assertEquals(RESULT_DONE, new CalculateRequestBuilder().setTask(task).setOptions(options).calculate()); assertEquals(options.getLaunchBounds(), mResult.mBounds); } @Test @EnableFlags({Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE, Flags.FLAG_ENABLE_SHELL_INITIAL_BOUNDS_REGRESSION_BUG_FIX}) Loading Loading
services/core/java/com/android/server/wm/DesktopModeBoundsCalculator.java +5 −2 Original line number Diff line number Diff line Loading @@ -73,9 +73,12 @@ public final class DesktopModeBoundsCalculator { final Rect stableBounds = new Rect(); task.getDisplayArea().getStableRect(stableBounds); // If the options bounds size is flexible, update size with calculated desired size. final boolean hasFullscreenOverride = activity != null && activity.mAppCompatController.getAspectRatioOverrides().hasFullscreenOverride(); // If the options bounds size is flexible and no fullscreen override has been applied, // update size with calculated desired size. final boolean updateOptionBoundsSize = options != null && options.getFlexibleLaunchSize(); && options.getFlexibleLaunchSize() && !hasFullscreenOverride; // If cascading is also enabled, the position of the options bounds must be respected // during the size update. final boolean shouldRespectOptionPosition = Loading
services/tests/wmtests/src/com/android/server/wm/DesktopModeLaunchParamsModifierTests.java +28 −2 Original line number Diff line number Diff line Loading @@ -383,7 +383,7 @@ public class DesktopModeLaunchParamsModifierTests extends spyOn(mActivity.mAppCompatController.getAspectRatioOverrides()); doReturn(true).when( mActivity.mAppCompatController.getAspectRatioOverrides()) .isUserFullscreenOverrideEnabled(); .hasFullscreenOverride(); final int desiredWidth = (int) (LANDSCAPE_DISPLAY_BOUNDS.width() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); Loading Loading @@ -411,7 +411,7 @@ public class DesktopModeLaunchParamsModifierTests extends spyOn(mActivity.mAppCompatController.getAspectRatioOverrides()); doReturn(true).when( mActivity.mAppCompatController.getAspectRatioOverrides()) .isSystemOverrideToFullscreenEnabled(); .hasFullscreenOverride(); final int desiredWidth = (int) (LANDSCAPE_DISPLAY_BOUNDS.width() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); Loading Loading @@ -1167,6 +1167,32 @@ public class DesktopModeLaunchParamsModifierTests extends assertEquals(WINDOWING_MODE_FREEFORM, mResult.mWindowingMode); } @Test @EnableFlags({Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE, Flags.FLAG_ENABLE_SHELL_INITIAL_BOUNDS_REGRESSION_BUG_FIX}) public void testOptionsBoundsSet_flexibleLaunchSizeWithFullscreenOverride_noModifications() { setupDesktopModeLaunchParamsModifier(); final TestDisplayContent display = createNewDisplayContent(WINDOWING_MODE_FULLSCREEN); final Task task = new TaskBuilder(mSupervisor).setActivityType( ACTIVITY_TYPE_STANDARD).setDisplay(display).build(); final ActivityOptions options = ActivityOptions.makeBasic() .setLaunchBounds(new Rect( DISPLAY_STABLE_BOUNDS.left, DISPLAY_STABLE_BOUNDS.top, /* right = */ 500, /* bottom = */ 500)) .setFlexibleLaunchSize(true); spyOn(mActivity.mAppCompatController.getAspectRatioOverrides()); doReturn(true).when( mActivity.mAppCompatController.getAspectRatioOverrides()) .hasFullscreenOverride(); assertEquals(RESULT_DONE, new CalculateRequestBuilder().setTask(task).setOptions(options).calculate()); assertEquals(options.getLaunchBounds(), mResult.mBounds); } @Test @EnableFlags({Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE, Flags.FLAG_ENABLE_SHELL_INITIAL_BOUNDS_REGRESSION_BUG_FIX}) Loading