diff options
6 files changed, 32 insertions, 48 deletions
diff --git a/libs/WindowManager/Shell/aconfig/multitasking.aconfig b/libs/WindowManager/Shell/aconfig/multitasking.aconfig index 0967f4e83c74..b61dda4c4e53 100644 --- a/libs/WindowManager/Shell/aconfig/multitasking.aconfig +++ b/libs/WindowManager/Shell/aconfig/multitasking.aconfig @@ -8,14 +8,6 @@ flag { } flag { - name: "enable_desktop_windowing" - namespace: "multitasking" - description: "Enables desktop windowing" - bug: "304778354" - is_fixed_read_only: true -} - -flag { name: "enable_split_contextual" namespace: "multitasking" description: "Enables invoking split contextually" diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeStatus.java b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeStatus.java index 88949b2a5acd..22ba70860587 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeStatus.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeStatus.java @@ -18,21 +18,13 @@ package com.android.wm.shell.desktopmode; import android.os.SystemProperties; -import com.android.wm.shell.Flags; +import com.android.window.flags.Flags; /** * Constants for desktop mode feature */ public class DesktopModeStatus { - private static final boolean ENABLE_DESKTOP_WINDOWING = Flags.enableDesktopWindowing(); - - /** - * Flag to indicate whether desktop mode proto is available on the device - */ - private static final boolean IS_PROTO2_ENABLED = SystemProperties.getBoolean( - "persist.wm.debug.desktop_mode_2", false); - /** * Flag to indicate whether task resizing is veiled. */ @@ -75,16 +67,10 @@ public class DesktopModeStatus { "persist.wm.debug.desktop_use_rounded_corners", true); /** - * Return {@code true} is desktop windowing proto 2 is enabled + * Return {@code true} if desktop windowing is enabled */ public static boolean isEnabled() { - // Check for aconfig flag first - if (ENABLE_DESKTOP_WINDOWING) { - return true; - } - // Fall back to sysprop flag - // TODO(b/304778354): remove sysprop once desktop aconfig flag supports dynamic overriding - return IS_PROTO2_ENABLED; + return Flags.enableDesktopWindowingMode(); } /** diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt index 33a69bf0d774..6bb846491224 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt @@ -369,12 +369,6 @@ object Flags { @Keep val WM_BUBBLE_BAR = sysPropBooleanFlag("persist.wm.debug.bubble_bar", default = false) - // TODO(b/260271148): Tracking bug - @Keep - @JvmField - val WM_DESKTOP_WINDOWING_2 = - sysPropBooleanFlag("persist.wm.debug.desktop_mode_2", default = false) - // TODO(b/254513207): Tracking Bug to delete @Keep @JvmField diff --git a/services/core/java/com/android/server/wm/DesktopModeLaunchParamsModifier.java b/services/core/java/com/android/server/wm/DesktopModeLaunchParamsModifier.java index f11d6ec0828c..925a0776bf1e 100644 --- a/services/core/java/com/android/server/wm/DesktopModeLaunchParamsModifier.java +++ b/services/core/java/com/android/server/wm/DesktopModeLaunchParamsModifier.java @@ -27,7 +27,7 @@ import android.os.SystemProperties; import android.util.Slog; import com.android.server.wm.LaunchParamsController.LaunchParamsModifier; -import com.android.wm.shell.Flags; +import com.android.window.flags.Flags; /** * The class that defines default launch params for tasks in desktop mode */ @@ -37,8 +37,6 @@ public class DesktopModeLaunchParamsModifier implements LaunchParamsModifier { TAG_WITH_CLASS_NAME ? "DesktopModeLaunchParamsModifier" : TAG_ATM; private static final boolean DEBUG = false; - // Desktop mode feature flags. - private static final boolean ENABLE_DESKTOP_WINDOWING = Flags.enableDesktopWindowing(); private static final boolean DESKTOP_MODE_PROTO2_SUPPORTED = SystemProperties.getBoolean("persist.wm.debug.desktop_mode_2", false); public static final float DESKTOP_MODE_INITIAL_BOUNDS_SCALE = @@ -67,6 +65,11 @@ public class DesktopModeLaunchParamsModifier implements LaunchParamsModifier { LaunchParamsController.LaunchParams currentParams, LaunchParamsController.LaunchParams outParams) { + if (!isDesktopModeEnabled()) { + appendLog("desktop mode is not enabled, continuing"); + return RESULT_CONTINUE; + } + if (task == null) { appendLog("task null, skipping"); return RESULT_SKIP; @@ -87,7 +90,7 @@ public class DesktopModeLaunchParamsModifier implements LaunchParamsModifier { // previous windowing mode to be restored even if the desktop mode state has changed. // Let task launches inherit the windowing mode from the source task if available, which // should have the desired windowing mode set by WM Shell. See b/286929122. - if (isDesktopModeSupported() && source != null && source.getTask() != null) { + if (isDesktopModeEnabled() && source != null && source.getTask() != null) { final Task sourceTask = source.getTask(); outParams.mWindowingMode = sourceTask.getWindowingMode(); appendLog("inherit-from-source=" + outParams.mWindowingMode); @@ -140,14 +143,8 @@ public class DesktopModeLaunchParamsModifier implements LaunchParamsModifier { if (DEBUG) Slog.d(TAG, mLogBuilder.toString()); } - /** Whether desktop mode is supported. */ - static boolean isDesktopModeSupported() { - // Check for aconfig flag first - if (ENABLE_DESKTOP_WINDOWING) { - return true; - } - // Fall back to sysprop flag - // TODO(b/304778354): remove sysprop once desktop aconfig flag supports dynamic overriding - return DESKTOP_MODE_PROTO2_SUPPORTED; + /** Whether desktop mode is enabled. */ + static boolean isDesktopModeEnabled() { + return Flags.enableDesktopWindowingMode(); } } diff --git a/services/core/java/com/android/server/wm/LaunchParamsController.java b/services/core/java/com/android/server/wm/LaunchParamsController.java index 91bb8d007948..97b5925893ae 100644 --- a/services/core/java/com/android/server/wm/LaunchParamsController.java +++ b/services/core/java/com/android/server/wm/LaunchParamsController.java @@ -64,10 +64,7 @@ class LaunchParamsController { void registerDefaultModifiers(ActivityTaskSupervisor supervisor) { // {@link TaskLaunchParamsModifier} handles window layout preferences. registerModifier(new TaskLaunchParamsModifier(supervisor)); - if (DesktopModeLaunchParamsModifier.isDesktopModeSupported()) { - // {@link DesktopModeLaunchParamsModifier} handles default task size changes - registerModifier(new DesktopModeLaunchParamsModifier()); - } + registerModifier(new DesktopModeLaunchParamsModifier()); } /** diff --git a/services/tests/wmtests/src/com/android/server/wm/DesktopModeLaunchParamsModifierTests.java b/services/tests/wmtests/src/com/android/server/wm/DesktopModeLaunchParamsModifierTests.java index ef36bff91a67..4060d40865d5 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DesktopModeLaunchParamsModifierTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DesktopModeLaunchParamsModifierTests.java @@ -24,6 +24,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static com.android.server.wm.DesktopModeLaunchParamsModifier.DESKTOP_MODE_INITIAL_BOUNDS_SCALE; import static com.android.server.wm.LaunchParamsController.LaunchParamsModifier.PHASE_BOUNDS; import static com.android.server.wm.LaunchParamsController.LaunchParamsModifier.PHASE_DISPLAY; +import static com.android.server.wm.LaunchParamsController.LaunchParamsModifier.RESULT_CONTINUE; import static com.android.server.wm.LaunchParamsController.LaunchParamsModifier.RESULT_DONE; import static com.android.server.wm.LaunchParamsController.LaunchParamsModifier.RESULT_SKIP; @@ -31,11 +32,14 @@ import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import android.graphics.Rect; +import android.platform.test.annotations.DisableFlags; +import android.platform.test.annotations.EnableFlags; import android.platform.test.annotations.Presubmit; import androidx.test.filters.SmallTest; import com.android.server.wm.LaunchParamsController.LaunchParamsModifier.Result; +import com.android.window.flags.Flags; import org.junit.Before; import org.junit.Test; @@ -70,11 +74,19 @@ public class DesktopModeLaunchParamsModifierTests extends WindowTestsBase { } @Test + @DisableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE) + public void testReturnsContinueIfDesktopWindowingIsDisabled() { + assertEquals(RESULT_CONTINUE, new CalculateRequestBuilder().setTask(null).calculate()); + } + + @Test + @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE) public void testReturnsSkipIfTaskIsNull() { assertEquals(RESULT_SKIP, new CalculateRequestBuilder().setTask(null).calculate()); } @Test + @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE) public void testReturnsSkipIfNotBoundsPhase() { final Task task = new TaskBuilder(mSupervisor).build(); assertEquals(RESULT_SKIP, new CalculateRequestBuilder().setTask(task).setPhase( @@ -82,6 +94,7 @@ public class DesktopModeLaunchParamsModifierTests extends WindowTestsBase { } @Test + @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE) public void testReturnsSkipIfTaskNotUsingActivityTypeStandardOrUndefined() { final Task task = new TaskBuilder(mSupervisor).setActivityType( ACTIVITY_TYPE_ASSISTANT).build(); @@ -89,6 +102,7 @@ public class DesktopModeLaunchParamsModifierTests extends WindowTestsBase { } @Test + @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE) public void testReturnsDoneIfTaskUsingActivityTypeStandard() { final Task task = new TaskBuilder(mSupervisor).setActivityType( ACTIVITY_TYPE_STANDARD).build(); @@ -96,6 +110,7 @@ public class DesktopModeLaunchParamsModifierTests extends WindowTestsBase { } @Test + @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE) public void testReturnsDoneIfTaskUsingActivityTypeUndefined() { final Task task = new TaskBuilder(mSupervisor).setActivityType( ACTIVITY_TYPE_UNDEFINED).build(); @@ -103,6 +118,7 @@ public class DesktopModeLaunchParamsModifierTests extends WindowTestsBase { } @Test + @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE) public void testReturnsSkipIfCurrentParamsHasBounds() { final Task task = new TaskBuilder(mSupervisor).setActivityType( ACTIVITY_TYPE_STANDARD).build(); @@ -111,6 +127,7 @@ public class DesktopModeLaunchParamsModifierTests extends WindowTestsBase { } @Test + @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE) public void testUsesDefaultBounds() { final Task task = new TaskBuilder(mSupervisor).setActivityType( ACTIVITY_TYPE_STANDARD).build(); @@ -125,6 +142,7 @@ public class DesktopModeLaunchParamsModifierTests extends WindowTestsBase { } @Test + @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE) public void testUsesDisplayAreaAndWindowingModeFromSource() { final Task task = new TaskBuilder(mSupervisor).setActivityType( ACTIVITY_TYPE_STANDARD).build(); |