Loading core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -6987,4 +6987,7 @@ <!-- Wear devices: An intent action that is used for remote intent. --> <string name="config_wearRemoteIntentAction" translatable="false" /> <!-- Whether desktop mode is supported on the current device --> <bool name="config_isDesktopModeSupported">false</bool> </resources> core/res/res/values/symbols.xml +3 −0 Original line number Diff line number Diff line Loading @@ -5387,4 +5387,7 @@ <java-symbol type="bool" name="config_deviceSupportsHighPerfTransitions" /> <java-symbol type="string" name="config_wearRemoteIntentAction" /> <!-- Whether desktop mode is supported on the current device --> <java-symbol type="bool" name="config_isDesktopModeSupported" /> </resources> libs/WindowManager/Shell/res/values/config.xml +0 −3 Original line number Diff line number Diff line Loading @@ -148,7 +148,4 @@ <!-- Whether pointer pilfer is required to start back animation. --> <bool name="config_backAnimationRequiresPointerPilfer">true</bool> <!-- Whether desktop mode is supported on the current device --> <bool name="config_isDesktopModeSupported">false</bool> </resources> libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeStatus.java +1 −1 Original line number Diff line number Diff line Loading @@ -20,9 +20,9 @@ import android.annotation.NonNull; import android.content.Context; import android.os.SystemProperties; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.window.flags.Flags; import com.android.wm.shell.R; /** * Constants for desktop mode feature Loading services/core/java/com/android/server/wm/DesktopModeLaunchParamsModifier.java +43 −4 Original line number Diff line number Diff line Loading @@ -19,13 +19,17 @@ package com.android.server.wm; import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_ATM; import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityOptions; import android.content.Context; import android.content.pm.ActivityInfo; import android.graphics.Rect; import android.os.SystemProperties; import android.util.Slog; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.server.wm.LaunchParamsController.LaunchParamsModifier; import com.android.window.flags.Flags; /** Loading @@ -37,14 +41,24 @@ public class DesktopModeLaunchParamsModifier implements LaunchParamsModifier { TAG_WITH_CLASS_NAME ? "DesktopModeLaunchParamsModifier" : TAG_ATM; private static final boolean DEBUG = false; 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 = SystemProperties .getInt("persist.wm.debug.desktop_mode_initial_bounds_scale", 75) / 100f; /** * Flag to indicate whether to restrict desktop mode to supported devices. */ private static final boolean ENFORCE_DEVICE_RESTRICTIONS = SystemProperties.getBoolean( "persist.wm.debug.desktop_mode_enforce_device_restrictions", true); private StringBuilder mLogBuilder; private final Context mContext; DesktopModeLaunchParamsModifier(@NonNull Context context) { mContext = context; } @Override public int onCalculate(@Nullable Task task, @Nullable ActivityInfo.WindowLayout layout, @Nullable ActivityRecord activity, @Nullable ActivityRecord source, Loading @@ -65,7 +79,7 @@ public class DesktopModeLaunchParamsModifier implements LaunchParamsModifier { LaunchParamsController.LaunchParams currentParams, LaunchParamsController.LaunchParams outParams) { if (!isDesktopModeEnabled()) { if (!canEnterDesktopMode(mContext)) { appendLog("desktop mode is not enabled, continuing"); return RESULT_CONTINUE; } Loading @@ -90,7 +104,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 (isDesktopModeEnabled() && source != null && source.getTask() != null) { if (source != null && source.getTask() != null) { final Task sourceTask = source.getTask(); outParams.mWindowingMode = sourceTask.getWindowingMode(); appendLog("inherit-from-source=" + outParams.mWindowingMode); Loading Loading @@ -147,4 +161,29 @@ public class DesktopModeLaunchParamsModifier implements LaunchParamsModifier { static boolean isDesktopModeEnabled() { return Flags.enableDesktopWindowingMode(); } /** * Return {@code true} if desktop mode should be restricted to supported devices. */ @VisibleForTesting public boolean enforceDeviceRestrictions() { return ENFORCE_DEVICE_RESTRICTIONS; } /** * Return {@code true} if the current device supports desktop mode. */ @VisibleForTesting public boolean isDesktopModeSupported(@NonNull Context context) { return context.getResources().getBoolean(R.bool.config_isDesktopModeSupported); } /** * Return {@code true} if desktop mode can be entered on the current device. */ boolean canEnterDesktopMode(@NonNull Context context) { return isDesktopModeEnabled() && (!enforceDeviceRestrictions() || isDesktopModeSupported(context)); } } Loading
core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -6987,4 +6987,7 @@ <!-- Wear devices: An intent action that is used for remote intent. --> <string name="config_wearRemoteIntentAction" translatable="false" /> <!-- Whether desktop mode is supported on the current device --> <bool name="config_isDesktopModeSupported">false</bool> </resources>
core/res/res/values/symbols.xml +3 −0 Original line number Diff line number Diff line Loading @@ -5387,4 +5387,7 @@ <java-symbol type="bool" name="config_deviceSupportsHighPerfTransitions" /> <java-symbol type="string" name="config_wearRemoteIntentAction" /> <!-- Whether desktop mode is supported on the current device --> <java-symbol type="bool" name="config_isDesktopModeSupported" /> </resources>
libs/WindowManager/Shell/res/values/config.xml +0 −3 Original line number Diff line number Diff line Loading @@ -148,7 +148,4 @@ <!-- Whether pointer pilfer is required to start back animation. --> <bool name="config_backAnimationRequiresPointerPilfer">true</bool> <!-- Whether desktop mode is supported on the current device --> <bool name="config_isDesktopModeSupported">false</bool> </resources>
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeStatus.java +1 −1 Original line number Diff line number Diff line Loading @@ -20,9 +20,9 @@ import android.annotation.NonNull; import android.content.Context; import android.os.SystemProperties; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.window.flags.Flags; import com.android.wm.shell.R; /** * Constants for desktop mode feature Loading
services/core/java/com/android/server/wm/DesktopModeLaunchParamsModifier.java +43 −4 Original line number Diff line number Diff line Loading @@ -19,13 +19,17 @@ package com.android.server.wm; import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_ATM; import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityOptions; import android.content.Context; import android.content.pm.ActivityInfo; import android.graphics.Rect; import android.os.SystemProperties; import android.util.Slog; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.server.wm.LaunchParamsController.LaunchParamsModifier; import com.android.window.flags.Flags; /** Loading @@ -37,14 +41,24 @@ public class DesktopModeLaunchParamsModifier implements LaunchParamsModifier { TAG_WITH_CLASS_NAME ? "DesktopModeLaunchParamsModifier" : TAG_ATM; private static final boolean DEBUG = false; 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 = SystemProperties .getInt("persist.wm.debug.desktop_mode_initial_bounds_scale", 75) / 100f; /** * Flag to indicate whether to restrict desktop mode to supported devices. */ private static final boolean ENFORCE_DEVICE_RESTRICTIONS = SystemProperties.getBoolean( "persist.wm.debug.desktop_mode_enforce_device_restrictions", true); private StringBuilder mLogBuilder; private final Context mContext; DesktopModeLaunchParamsModifier(@NonNull Context context) { mContext = context; } @Override public int onCalculate(@Nullable Task task, @Nullable ActivityInfo.WindowLayout layout, @Nullable ActivityRecord activity, @Nullable ActivityRecord source, Loading @@ -65,7 +79,7 @@ public class DesktopModeLaunchParamsModifier implements LaunchParamsModifier { LaunchParamsController.LaunchParams currentParams, LaunchParamsController.LaunchParams outParams) { if (!isDesktopModeEnabled()) { if (!canEnterDesktopMode(mContext)) { appendLog("desktop mode is not enabled, continuing"); return RESULT_CONTINUE; } Loading @@ -90,7 +104,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 (isDesktopModeEnabled() && source != null && source.getTask() != null) { if (source != null && source.getTask() != null) { final Task sourceTask = source.getTask(); outParams.mWindowingMode = sourceTask.getWindowingMode(); appendLog("inherit-from-source=" + outParams.mWindowingMode); Loading Loading @@ -147,4 +161,29 @@ public class DesktopModeLaunchParamsModifier implements LaunchParamsModifier { static boolean isDesktopModeEnabled() { return Flags.enableDesktopWindowingMode(); } /** * Return {@code true} if desktop mode should be restricted to supported devices. */ @VisibleForTesting public boolean enforceDeviceRestrictions() { return ENFORCE_DEVICE_RESTRICTIONS; } /** * Return {@code true} if the current device supports desktop mode. */ @VisibleForTesting public boolean isDesktopModeSupported(@NonNull Context context) { return context.getResources().getBoolean(R.bool.config_isDesktopModeSupported); } /** * Return {@code true} if desktop mode can be entered on the current device. */ boolean canEnterDesktopMode(@NonNull Context context) { return isDesktopModeEnabled() && (!enforceDeviceRestrictions() || isDesktopModeSupported(context)); } }