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

Commit a7a919c0 authored by Garfield Tan's avatar Garfield Tan
Browse files

Don't set windowing mode in fullscreen displays.

We don't want to launch tasks in freeform mode in fullscreen displays
only because they were in freeform mode before.

Bug: 135941344
Bug: 135780225
Test: Manual tests.
Test: atest WmTests:TaskLaunchParamsModifierTests
Change-Id: Ifd466d1e11c8131ecf1e587aeac6f2eba15f6432
parent 3129b853
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -211,7 +211,9 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
        if (!currentParams.isEmpty() && !hasInitialBounds
                && (!currentParams.hasPreferredDisplay()
                    || displayId == currentParams.mPreferredDisplayId)) {
            if (currentParams.hasWindowingMode()) {
            // Only set windowing mode if display is in freeform. If the display is in fullscreen
            // mode we should only launch a task in fullscreen mode.
            if (currentParams.hasWindowingMode() && display.inFreeformWindowingMode()) {
                launchMode = currentParams.mWindowingMode;
                fullyResolvedCurrentParam = launchMode != WINDOWING_MODE_FREEFORM;
                if (DEBUG) {
+27 −1
Original line number Diff line number Diff line
@@ -345,6 +345,19 @@ public class TaskLaunchParamsModifierTests extends ActivityTestsBase {
                WINDOWING_MODE_FULLSCREEN);
    }

    @Test
    public void testLaunchesFullscreenOnFullscreenDisplayWithFreeformHistory() {
        mCurrent.mPreferredDisplayId = Display.INVALID_DISPLAY;
        mCurrent.mWindowingMode = WINDOWING_MODE_FREEFORM;
        mCurrent.mBounds.set(0, 0, 200, 100);

        assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
                mActivity, /* source */ null, /* options */ null, mCurrent, mResult));

        assertEquivalentWindowingMode(WINDOWING_MODE_FULLSCREEN, mResult.mWindowingMode,
                WINDOWING_MODE_FULLSCREEN);
    }

    @Test
    public void testRespectsFullyResolvedCurrentParam_Fullscreen() {
        final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
@@ -1173,6 +1186,19 @@ public class TaskLaunchParamsModifierTests extends ActivityTestsBase {
        assertEquals(new Rect(0, 0, 1680, 953), mResult.mBounds);
    }

    @Test
    public void returnsNonFullscreenBoundsOnFullscreenDisplayWithFreeformHistory() {
        mCurrent.mPreferredDisplayId = Display.INVALID_DISPLAY;
        mCurrent.mWindowingMode = WINDOWING_MODE_FREEFORM;
        mCurrent.mBounds.set(0, 0, 200, 100);

        assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
                mActivity, /* source */ null, /* options */ null, mCurrent, mResult));

        // Returned bounds with in fullscreen mode will be set to last non-fullscreen bounds.
        assertEquals(new Rect(0, 0, 200, 100), mCurrent.mBounds);
    }

    @Test
    public void testAdjustsBoundsToFitInDisplayFullyResolvedBounds() {
        final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
@@ -1186,7 +1212,7 @@ public class TaskLaunchParamsModifierTests extends ActivityTestsBase {
        options.setLaunchDisplayId(freeformDisplay.mDisplayId);

        assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
                mActivity, /* source */ null, /* options */ null, mCurrent, mResult));
                mActivity, /* source */ null, options, mCurrent, mResult));

        assertEquals(new Rect(0, 0, 300, 300), mResult.mBounds);
    }