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

Commit ca05ff64 authored by Eghosa Ewansiha-Vlachavas's avatar Eghosa Ewansiha-Vlachavas Committed by Android (Google) Code Review
Browse files

Merge "Don't update flexible option bounds if fullscreen override applied" into main

parents c6ad7cd0 beedabc4
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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 =
+28 −2
Original line number Diff line number Diff line
@@ -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);
@@ -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);
@@ -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})