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

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

Merge changes I6f02536e,I591063b4 into main

* changes:
  [2/n] Respect fullscreen activity options in desktop launch params
  [1/n] Add RespectFullscreenActivityOptionInDesktopLaunchParams flag
parents 8e389845 14f40d41
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -204,6 +204,9 @@ public enum DesktopExperienceFlags {
            Flags.FLAG_FORM_FACTOR_BASED_DESKTOP_FIRST_SWITCH),
    REPARENT_WINDOW_TOKEN_API(Flags::reparentWindowTokenApi, true,
            Flags.FLAG_REPARENT_WINDOW_TOKEN_API),
    RESPECT_FULLSCREEN_ACTIVITY_OPTION_IN_DESKTOP_LAUNCH_PARAMS(
            Flags::respectFullscreenActivityOptionInDesktopLaunchParams, false,
            Flags.FLAG_RESPECT_FULLSCREEN_ACTIVITY_OPTION_IN_DESKTOP_LAUNCH_PARAMS),
    USE_RESOURCES_FROM_CONTEXT_TO_CREATE_DRAWABLE_ICONS(
            com.android.graphics.flags.Flags::useResourcesFromContextToCreateDrawableIcons,
            true,
+11 −0
Original line number Diff line number Diff line
@@ -166,6 +166,17 @@ flag {
    }
}

flag {
    name: "respect_fullscreen_activity_option_in_desktop_launch_params"
    namespace: "lse_desktop_experience"
    description: "Prevents DesktopModeLaunchParamsModifier from modifying launch params for /n"
                 "activities which request fullscreen via their activity options."
    bug: "416032057"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "enable_desktop_windowing_wallpaper_activity"
    namespace: "lse_desktop_experience"
+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})