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

Commit 13728691 authored by Ats Jenk's avatar Ats Jenk Committed by Android (Google) Code Review
Browse files

Merge changes from topic "desktop-aconfig-flag" into main

* changes:
  Use aconfig flag for desktop mode
  Mark desktop windowing flag as fixed read only
parents ca93fe1b 7ce5eb57
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -15,10 +15,11 @@ flag {
}
}


flag {
flag {
    name: "desktop_windowing"
    name: "enable_desktop_windowing"
    namespace: "multitasking"
    namespace: "multitasking"
    description: "Enables desktop windowing"
    description: "Enables desktop windowing"
    bug: "304778354"
    bug: "304778354"
    is_fixed_read_only: true
}
}


flag {
flag {
+10 −0
Original line number Original line Diff line number Diff line
@@ -18,11 +18,15 @@ package com.android.wm.shell.desktopmode;


import android.os.SystemProperties;
import android.os.SystemProperties;


import com.android.wm.shell.Flags;

/**
/**
 * Constants for desktop mode feature
 * Constants for desktop mode feature
 */
 */
public class DesktopModeStatus {
public class DesktopModeStatus {


    private static final boolean ENABLE_DESKTOP_WINDOWING = Flags.enableDesktopWindowing();

    /**
    /**
     * Flag to indicate whether desktop mode proto is available on the device
     * Flag to indicate whether desktop mode proto is available on the device
     */
     */
@@ -54,6 +58,12 @@ public class DesktopModeStatus {
     * Return {@code true} is desktop windowing proto 2 is enabled
     * Return {@code true} is desktop windowing proto 2 is enabled
     */
     */
    public static boolean isEnabled() {
    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 IS_PROTO2_ENABLED;
    }
    }


+1 −0
Original line number Original line Diff line number Diff line
@@ -198,6 +198,7 @@ java_library_static {
        "notification_flags_lib",
        "notification_flags_lib",
        "biometrics_flags_lib",
        "biometrics_flags_lib",
        "am_flags_lib",
        "am_flags_lib",
        "com_android_wm_shell_flags_lib",
    ],
    ],
    javac_shard_size: 50,
    javac_shard_size: 50,
    javacflags: [
    javacflags: [
+9 −1
Original line number Original line Diff line number Diff line
@@ -29,6 +29,7 @@ import android.os.SystemProperties;
import android.util.Slog;
import android.util.Slog;


import com.android.server.wm.LaunchParamsController.LaunchParamsModifier;
import com.android.server.wm.LaunchParamsController.LaunchParamsModifier;
import com.android.wm.shell.Flags;


/**
/**
 * The class that defines default launch params for tasks in desktop mode
 * The class that defines default launch params for tasks in desktop mode
@@ -40,6 +41,7 @@ public class DesktopModeLaunchParamsModifier implements LaunchParamsModifier {
    private static final boolean DEBUG = false;
    private static final boolean DEBUG = false;


    // Desktop mode feature flags.
    // Desktop mode feature flags.
    private static final boolean ENABLE_DESKTOP_WINDOWING = Flags.enableDesktopWindowing();
    private static final boolean DESKTOP_MODE_PROTO2_SUPPORTED =
    private static final boolean DESKTOP_MODE_PROTO2_SUPPORTED =
            SystemProperties.getBoolean("persist.wm.debug.desktop_mode_2", false);
            SystemProperties.getBoolean("persist.wm.debug.desktop_mode_2", false);
    // Override default freeform task width when desktop mode is enabled. In dips.
    // Override default freeform task width when desktop mode is enabled. In dips.
@@ -91,7 +93,7 @@ public class DesktopModeLaunchParamsModifier implements LaunchParamsModifier {
        // previous windowing mode to be restored even if the desktop mode state has changed.
        // 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
        // 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.
        // should have the desired windowing mode set by WM Shell. See b/286929122.
        if (DESKTOP_MODE_PROTO2_SUPPORTED && source != null && source.getTask() != null) {
        if (isDesktopModeSupported() && source != null && source.getTask() != null) {
            final Task sourceTask = source.getTask();
            final Task sourceTask = source.getTask();
            outParams.mWindowingMode = sourceTask.getWindowingMode();
            outParams.mWindowingMode = sourceTask.getWindowingMode();
            appendLog("inherit-from-source=" + outParams.mWindowingMode);
            appendLog("inherit-from-source=" + outParams.mWindowingMode);
@@ -140,6 +142,12 @@ public class DesktopModeLaunchParamsModifier implements LaunchParamsModifier {


    /** Whether desktop mode is supported. */
    /** Whether desktop mode is supported. */
    static boolean isDesktopModeSupported() {
    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;
        return DESKTOP_MODE_PROTO2_SUPPORTED;
    }
    }
}
}