Loading services/core/java/com/android/server/wm/DesktopModeLaunchParamsModifier.java +5 −6 Original line number Diff line number Diff line Loading @@ -164,17 +164,16 @@ public class DesktopModeLaunchParamsModifier implements LaunchParamsModifier { private void calculateAndCentreInitialBounds(Task task, LaunchParamsController.LaunchParams outParams) { // TODO(b/319819547): Account for app constraints so apps do not become letterboxed final Rect stableBounds = new Rect(); task.getDisplayArea().getStableRect(stableBounds); final Rect screenBounds = task.getDisplayArea().getBounds(); // The desired dimensions that a fully resizable window should take when initially entering // desktop mode. Calculated as a percentage of the available display area as defined by the // DESKTOP_MODE_INITIAL_BOUNDS_SCALE. final int desiredWidth = (int) (stableBounds.width() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); final int desiredHeight = (int) (stableBounds.height() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); final int desiredWidth = (int) (screenBounds.width() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); final int desiredHeight = (int) (screenBounds.height() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); outParams.mBounds.right = desiredWidth; outParams.mBounds.bottom = desiredHeight; outParams.mBounds.offset(stableBounds.centerX() - outParams.mBounds.centerX(), stableBounds.centerY() - outParams.mBounds.centerY()); outParams.mBounds.offset(screenBounds.centerX() - outParams.mBounds.centerX(), screenBounds.centerY() - outParams.mBounds.centerY()); } private void initLogBuilder(Task task, ActivityRecord activity) { Loading services/tests/wmtests/src/com/android/server/wm/DesktopModeLaunchParamsModifierTests.java +2 −2 Original line number Diff line number Diff line Loading @@ -166,9 +166,9 @@ public class DesktopModeLaunchParamsModifierTests extends ACTIVITY_TYPE_STANDARD).setDisplay(display).build(); final int desiredWidth = (int) (DISPLAY_STABLE_BOUNDS.width() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); (int) (DISPLAY_BOUNDS.width() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); final int desiredHeight = (int) (DISPLAY_STABLE_BOUNDS.height() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); (int) (DISPLAY_BOUNDS.height() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); assertEquals(RESULT_CONTINUE, new CalculateRequestBuilder().setTask(task).calculate()); assertEquals(desiredWidth, mResult.mBounds.width()); assertEquals(desiredHeight, mResult.mBounds.height()); Loading Loading
services/core/java/com/android/server/wm/DesktopModeLaunchParamsModifier.java +5 −6 Original line number Diff line number Diff line Loading @@ -164,17 +164,16 @@ public class DesktopModeLaunchParamsModifier implements LaunchParamsModifier { private void calculateAndCentreInitialBounds(Task task, LaunchParamsController.LaunchParams outParams) { // TODO(b/319819547): Account for app constraints so apps do not become letterboxed final Rect stableBounds = new Rect(); task.getDisplayArea().getStableRect(stableBounds); final Rect screenBounds = task.getDisplayArea().getBounds(); // The desired dimensions that a fully resizable window should take when initially entering // desktop mode. Calculated as a percentage of the available display area as defined by the // DESKTOP_MODE_INITIAL_BOUNDS_SCALE. final int desiredWidth = (int) (stableBounds.width() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); final int desiredHeight = (int) (stableBounds.height() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); final int desiredWidth = (int) (screenBounds.width() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); final int desiredHeight = (int) (screenBounds.height() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); outParams.mBounds.right = desiredWidth; outParams.mBounds.bottom = desiredHeight; outParams.mBounds.offset(stableBounds.centerX() - outParams.mBounds.centerX(), stableBounds.centerY() - outParams.mBounds.centerY()); outParams.mBounds.offset(screenBounds.centerX() - outParams.mBounds.centerX(), screenBounds.centerY() - outParams.mBounds.centerY()); } private void initLogBuilder(Task task, ActivityRecord activity) { Loading
services/tests/wmtests/src/com/android/server/wm/DesktopModeLaunchParamsModifierTests.java +2 −2 Original line number Diff line number Diff line Loading @@ -166,9 +166,9 @@ public class DesktopModeLaunchParamsModifierTests extends ACTIVITY_TYPE_STANDARD).setDisplay(display).build(); final int desiredWidth = (int) (DISPLAY_STABLE_BOUNDS.width() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); (int) (DISPLAY_BOUNDS.width() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); final int desiredHeight = (int) (DISPLAY_STABLE_BOUNDS.height() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); (int) (DISPLAY_BOUNDS.height() * DESKTOP_MODE_INITIAL_BOUNDS_SCALE); assertEquals(RESULT_CONTINUE, new CalculateRequestBuilder().setTask(task).calculate()); assertEquals(desiredWidth, mResult.mBounds.width()); assertEquals(desiredHeight, mResult.mBounds.height()); Loading