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

Commit 14f40d41 authored by Eghosa Ewansiha-Vlachavas's avatar Eghosa Ewansiha-Vlachavas
Browse files

[2/n] Respect fullscreen activity options in desktop launch params

If an activity specifically request fullscreen via its activity options,
skip the desktop launch params modifier so it don't not modify the
window mode or bounds.

Flag: com.android.window.flags.respect_fullscreen_activity_option_in_desktop_launch_params
Test: atest WmTests:DesktopModeLaunchParamsModifierTests
Bug: 416032057

Change-Id: I6f02536eb4ecde5713f192ee5616c0da82868902
parent 73f02d52
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.app.WindowConfiguration;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.util.Slog;
import android.window.DesktopExperienceFlags;
import android.window.DesktopModeFlags;

import com.android.internal.annotations.VisibleForTesting;
@@ -130,6 +131,14 @@ class DesktopModeLaunchParamsModifier implements LaunchParamsModifier {
            return RESULT_SKIP;
        }

        boolean requestFullscreen = options != null
                && options.getLaunchWindowingMode() == WINDOWING_MODE_FULLSCREEN;
        if (DesktopExperienceFlags.RESPECT_FULLSCREEN_ACTIVITY_OPTION_IN_DESKTOP_LAUNCH_PARAMS
                .isTrue() && requestFullscreen) {
            appendLog("respecting fullscreen activity option, skipping");
            return RESULT_SKIP;
        }

        final Task organizerTask = task.getCreatedByOrganizerTask();
        // If task is already launched, check if organizer task matches the target display.
        final boolean inDesktopFirstContainer = ENABLE_FREEFORM_DISPLAY_LAUNCH_PARAMS.isTrue() && (
@@ -152,8 +161,6 @@ class DesktopModeLaunchParamsModifier implements LaunchParamsModifier {
        // Copy over any values
        outParams.set(currentParams);

        boolean requestFullscreen = options != null
                && options.getLaunchWindowingMode() == WINDOWING_MODE_FULLSCREEN;
        boolean isFullscreenInDeskTask = inDesktopFirstContainer && requestFullscreen;
        if (source != null && source.getTask() != null) {
            final Task sourceTask = source.getTask();
+15 −0
Original line number Diff line number Diff line
@@ -162,6 +162,21 @@ public class DesktopModeLaunchParamsModifierTests extends
        assertEquals(RESULT_SKIP, new CalculateRequestBuilder().setTask(task).calculate());
    }

    @Test
    @EnableFlags({Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE,
            Flags.FLAG_RESPECT_FULLSCREEN_ACTIVITY_OPTION_IN_DESKTOP_LAUNCH_PARAMS})
    public void testReturnsSkipIfFullscreenRequestViaActivityOptions() {
        setupDesktopModeLaunchParamsModifier();
        when(mTarget.isEnteringDesktopMode(any(), any(), any())).thenReturn(true);

        final Task task = new TaskBuilder(mSupervisor).build();
        final ActivityOptions options = ActivityOptions.makeBasic();
        options.setLaunchWindowingMode(WINDOWING_MODE_FULLSCREEN);

        assertEquals(RESULT_SKIP,
                new CalculateRequestBuilder().setTask(task).setOptions(options).calculate());
    }

    @Test
    @EnableFlags({Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE,
            Flags.FLAG_DISABLE_DESKTOP_LAUNCH_PARAMS_OUTSIDE_DESKTOP_BUG_FIX})