Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4338b5a authored by Alp Yalcin's avatar Alp Yalcin Committed by Android (Google) Code Review
Browse files

Merge changes from topic "UpdateDefaultBounds" into main

* changes:
  [2/n] Update default initial bounds scale to 72% (from 75%)
  [1/n] Round to the nearest integer after all division operations in the bounds calculation
parents 27743398 3fe2b163
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ import kotlin.math.max
import kotlin.math.min

val DESKTOP_MODE_INITIAL_BOUNDS_SCALE: Float =
    SystemProperties.getInt("persist.wm.debug.desktop_mode_initial_bounds_scale", 75) / 100f
    SystemProperties.getInt("persist.wm.debug.desktop_mode_initial_bounds_scale", 72) / 100f

val DESKTOP_MODE_LANDSCAPE_APP_PADDING: Int =
    SystemProperties.getInt("persist.wm.debug.desktop_mode_landscape_app_padding", 25)
+2 −1
Original line number Diff line number Diff line
@@ -5900,9 +5900,10 @@ class DesktopTasksController(
    }

    companion object {
        // TODO(b/434658423): Consolidate below constant among DesktopModeUtils and this file.
        @JvmField
        val DESKTOP_MODE_INITIAL_BOUNDS_SCALE =
            SystemProperties.getInt("persist.wm.debug.desktop_mode_initial_bounds_scale", 75) / 100f
            SystemProperties.getInt("persist.wm.debug.desktop_mode_initial_bounds_scale", 72) / 100f

        // Timeout used for CUJ_DESKTOP_MODE_ENTER_APP_HANDLE_DRAG_HOLD, this is longer than the
        // default timeout to avoid timing out in the middle of a drag action.
+1 −1
Original line number Diff line number Diff line
@@ -162,7 +162,7 @@ fun FlickerTest.appWindowHasDesktopModeInitialBoundsAtTheEnd(component: ICompone
            entry.physicalDisplayBounds ?: error("Missing physical display bounds")
        val stableBounds = WindowUtils.getInsetDisplayBounds(scenario.endRotation)
        val desktopModeInitialBoundsScale =
            SystemProperties.getInt("persist.wm.debug.desktop_mode_initial_bounds_scale", 75) /
            SystemProperties.getInt("persist.wm.debug.desktop_mode_initial_bounds_scale", 72) /
                100f

        val desiredWidth = displayBounds.width().times(desktopModeInitialBoundsScale)
+11 −11
Original line number Diff line number Diff line
@@ -316,12 +316,12 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
    private val SECONDARY_DISPLAY_ID = 1
    private val DISPLAY_DIMENSION_SHORT = 1600
    private val DISPLAY_DIMENSION_LONG = 2560
    private val DEFAULT_LANDSCAPE_BOUNDS = Rect(320, 75, 2240, 1275)
    private val DEFAULT_PORTRAIT_BOUNDS = Rect(200, 165, 1400, 2085)
    private val DEFAULT_LANDSCAPE_BOUNDS = Rect(358, 93, 2201, 1245)
    private val DEFAULT_PORTRAIT_BOUNDS = Rect(224, 193, 1376, 2036)
    private val RESIZABLE_LANDSCAPE_BOUNDS = Rect(25, 435, 1575, 1635)
    private val RESIZABLE_PORTRAIT_BOUNDS = Rect(680, 75, 1880, 1275)
    private val RESIZABLE_PORTRAIT_BOUNDS = Rect(680, 93, 1880, 1245)
    private val UNRESIZABLE_LANDSCAPE_BOUNDS = Rect(25, 448, 1575, 1611)
    private val UNRESIZABLE_PORTRAIT_BOUNDS = Rect(830, 75, 1730, 1275)
    private val UNRESIZABLE_PORTRAIT_BOUNDS = Rect(848, 93, 1712, 1245)
    private val wallpaperToken = MockToken().token()
    private val homeComponentName = ComponentName(HOME_LAUNCHER_PACKAGE_NAME, /* class */ "")
    private val secondDisplayArea =
@@ -9778,7 +9778,7 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
        testOnUnhandledDrag(
            DesktopModeVisualIndicator.IndicatorType.TO_DESKTOP_INDICATOR,
            PointF(1200f, 700f),
            Rect(240, 700, 2160, 1900),
            Rect(279, 700, 2122, 1852),
            tabTearingMinimizeAnimationFlagEnabled = true,
            tabTearingLaunchAnimationFlagEnabled = true,
        )
@@ -9791,7 +9791,7 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
        testOnUnhandledDrag(
            DesktopModeVisualIndicator.IndicatorType.TO_DESKTOP_INDICATOR,
            PointF(1200f, 700f),
            Rect(240, 700, 2160, 1900),
            Rect(279, 700, 2122, 1852),
            tabTearingMinimizeAnimationFlagEnabled = true,
            tabTearingLaunchAnimationFlagEnabled = false,
        )
@@ -9804,7 +9804,7 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
        testOnUnhandledDrag(
            DesktopModeVisualIndicator.IndicatorType.TO_DESKTOP_INDICATOR,
            PointF(1200f, 700f),
            Rect(240, 700, 2160, 1900),
            Rect(279, 700, 2122, 1852),
            tabTearingMinimizeAnimationFlagEnabled = false,
            tabTearingLaunchAnimationFlagEnabled = true,
        )
@@ -9819,7 +9819,7 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
        testOnUnhandledDrag(
            DesktopModeVisualIndicator.IndicatorType.TO_DESKTOP_INDICATOR,
            PointF(1200f, 700f),
            Rect(240, 700, 2160, 1900),
            Rect(279, 700, 2122, 1852),
            tabTearingMinimizeAnimationFlagEnabled = false,
            tabTearingLaunchAnimationFlagEnabled = false,
        )
@@ -10006,7 +10006,7 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
        testOnUnhandledDrag(
            DesktopModeVisualIndicator.IndicatorType.NO_INDICATOR,
            PointF(1200f, 700f),
            Rect(240, 700, 2160, 1900),
            Rect(279, 700, 2122, 1852),
            tabTearingMinimizeAnimationFlagEnabled = true,
            tabTearingLaunchAnimationFlagEnabled = true,
            destinationDisplayId = SECOND_DISPLAY,
@@ -10029,7 +10029,7 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
        testOnUnhandledDrag(
            DesktopModeVisualIndicator.IndicatorType.NO_INDICATOR,
            PointF(1200f, 700f),
            Rect(240, 700, 2160, 1900),
            Rect(279, 700, 2122, 1852),
            tabTearingMinimizeAnimationFlagEnabled = true,
            tabTearingLaunchAnimationFlagEnabled = true,
            destinationDisplayId = SECOND_DISPLAY,
@@ -10049,7 +10049,7 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
        testOnUnhandledDrag(
            DesktopModeVisualIndicator.IndicatorType.NO_INDICATOR,
            PointF(1200f, 700f),
            Rect(240, 700, 2160, 1900),
            Rect(279, 700, 2122, 1852),
            tabTearingMinimizeAnimationFlagEnabled = true,
            tabTearingLaunchAnimationFlagEnabled = true,
            destinationDisplayId = SECOND_DISPLAY,
+3 −3
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ import java.util.function.Consumer;
public final class DesktopModeBoundsCalculator {

    public static final float DESKTOP_MODE_INITIAL_BOUNDS_SCALE = SystemProperties
            .getInt("persist.wm.debug.desktop_mode_initial_bounds_scale", 75) / 100f;
            .getInt("persist.wm.debug.desktop_mode_initial_bounds_scale", 72) / 100f;
    public static final int DESKTOP_MODE_LANDSCAPE_APP_PADDING = SystemProperties
            .getInt("persist.wm.debug.desktop_mode_landscape_app_padding", 25);

@@ -292,7 +292,7 @@ public final class DesktopModeBoundsCalculator {
        if (orientation == ORIENTATION_PORTRAIT) {
            // Portrait activity.
            // Calculate required width given ideal height and aspect ratio.
            int tempWidth = (int) (targetHeight / aspectRatio);
            int tempWidth = (int) ((targetHeight / aspectRatio) + 0.5f);
            if (tempWidth <= targetWidth) {
                // If the calculated width does not exceed the ideal width, overall size is within
                // ideal size and can be applied.
@@ -319,7 +319,7 @@ public final class DesktopModeBoundsCalculator {
                // aspect ratio. Instead apply ideal width and calculate required height to respect
                // aspect ratio.
                finalWidth = targetWidth;
                finalHeight = (int) (finalWidth / aspectRatio);
                finalHeight = (int) ((finalWidth / aspectRatio) + 0.5f);
            }
        }
        return new Size(finalWidth, finalHeight + captionHeight);
Loading