Loading core/res/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -7213,6 +7213,10 @@ screen. --> <bool name="config_dragToMaximizeInDesktopMode">false</bool> <!-- Whether showing the app handle is supported on this device. If config_isDesktopModeSupported, then this has no effect --> <bool name="config_enableAppHandle">false</bool> <!-- Frame rate compatibility value for Wallpaper FRAME_RATE_COMPATIBILITY_MIN (102) is used by default for lower power consumption --> <integer name="config_wallpaperFrameRateCompatibility">102</integer> Loading core/res/res/values/symbols.xml +3 −0 Original line number Diff line number Diff line Loading @@ -5764,6 +5764,9 @@ screen. --> <java-symbol type="bool" name="config_dragToMaximizeInDesktopMode" /> <!-- Whether showing the app handle is supported on this device --> <java-symbol type="bool" name="config_enableAppHandle" /> <!-- Frame rate compatibility value for Wallpaper --> <java-symbol type="integer" name="config_wallpaperFrameRateCompatibility" /> Loading libs/WindowManager/Shell/shared/Android.bp +0 −2 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ filegroup { name: "wm_shell-shared-utils", srcs: [ "src/com/android/wm/shell/shared/TransitionUtil.java", "src/com/android/wm/shell/shared/Utils.java", ], } Loading Loading @@ -72,7 +71,6 @@ java_library { srcs: [ "**/desktopmode/*.java", "**/desktopmode/*.kt", ":wm_shell-shared-utils", ], static_libs: [ "com.android.window.flags.window-aconfig-java", Loading libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/Utils.javadeleted 100644 → 0 +0 −46 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.wm.shell.shared; import android.annotation.NonNull; import java.util.function.Supplier; /** * This class provides generic utility methods and classes for shell */ public class Utils { /** * Lazily returns object from a supplier with caching * @param <T> type of object to get */ public static class Lazy<T> { private T mInstance; /** * @param supplier the supplier that defines the return value if not defined already * @return the cached value or the value from the supplier */ public final T get(@NonNull Supplier<T> supplier) { if (mInstance == null) { mInstance = supplier.get(); } return mInstance; } } } libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeStatus.java +3 −20 Original line number Diff line number Diff line Loading @@ -16,19 +16,14 @@ package com.android.wm.shell.shared.desktopmode; import static android.hardware.devicestate.DeviceState.PROPERTY_FOLDABLE_DISPLAY_CONFIGURATION_INNER_PRIMARY; import static android.hardware.devicestate.DeviceState.PROPERTY_FOLDABLE_DISPLAY_CONFIGURATION_OUTER_PRIMARY; import android.annotation.NonNull; import android.content.Context; import android.hardware.devicestate.DeviceStateManager; import android.os.SystemProperties; import android.window.DesktopModeFlags; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.window.flags.Flags; import com.android.wm.shell.shared.Utils.Lazy; import java.io.PrintWriter; Loading @@ -40,8 +35,6 @@ public class DesktopModeStatus { private static final String TAG = "DesktopModeStatus"; private static Lazy<Boolean> sIsFoldableDevice = new Lazy<>(); /** * Flag to indicate whether task resizing is veiled. */ Loading Loading @@ -202,7 +195,8 @@ public class DesktopModeStatus { * necessarily enabling desktop mode */ public static boolean overridesShowAppHandle(@NonNull Context context) { return Flags.showAppHandleLargeScreens() && isDeviceFoldable(context); return Flags.showAppHandleLargeScreens() && context.getResources().getBoolean(R.bool.config_enableAppHandle); } /** Loading Loading @@ -249,17 +243,6 @@ public class DesktopModeStatus { return !enforceDeviceRestrictions() || isDesktopModeSupported(context); } /** * @return {@code true} if this is a foldable device */ private static boolean isDeviceFoldable(@NonNull Context context) { return sIsFoldableDevice.get(() -> context.getSystemService(DeviceStateManager.class) .getSupportedDeviceStates().stream().anyMatch(state -> state.hasProperty(PROPERTY_FOLDABLE_DISPLAY_CONFIGURATION_OUTER_PRIMARY) || state.hasProperty( PROPERTY_FOLDABLE_DISPLAY_CONFIGURATION_INNER_PRIMARY))); } /** * Return {@code true} if a display should enter desktop mode by default when the windowing mode * of the display's root [TaskDisplayArea] is set to WINDOWING_MODE_FREEFORM. Loading Loading @@ -300,6 +283,6 @@ public class DesktopModeStatus { pw.println(maxTaskLimitHandle == null ? "null" : maxTaskLimitHandle.getInt(/* def= */ -1)); pw.print(innerPrefix); pw.print("showAppHandle config override="); pw.print(overridesShowAppHandle(context)); pw.print(context.getResources().getBoolean(R.bool.config_enableAppHandle)); } } Loading
core/res/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -7213,6 +7213,10 @@ screen. --> <bool name="config_dragToMaximizeInDesktopMode">false</bool> <!-- Whether showing the app handle is supported on this device. If config_isDesktopModeSupported, then this has no effect --> <bool name="config_enableAppHandle">false</bool> <!-- Frame rate compatibility value for Wallpaper FRAME_RATE_COMPATIBILITY_MIN (102) is used by default for lower power consumption --> <integer name="config_wallpaperFrameRateCompatibility">102</integer> Loading
core/res/res/values/symbols.xml +3 −0 Original line number Diff line number Diff line Loading @@ -5764,6 +5764,9 @@ screen. --> <java-symbol type="bool" name="config_dragToMaximizeInDesktopMode" /> <!-- Whether showing the app handle is supported on this device --> <java-symbol type="bool" name="config_enableAppHandle" /> <!-- Frame rate compatibility value for Wallpaper --> <java-symbol type="integer" name="config_wallpaperFrameRateCompatibility" /> Loading
libs/WindowManager/Shell/shared/Android.bp +0 −2 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ filegroup { name: "wm_shell-shared-utils", srcs: [ "src/com/android/wm/shell/shared/TransitionUtil.java", "src/com/android/wm/shell/shared/Utils.java", ], } Loading Loading @@ -72,7 +71,6 @@ java_library { srcs: [ "**/desktopmode/*.java", "**/desktopmode/*.kt", ":wm_shell-shared-utils", ], static_libs: [ "com.android.window.flags.window-aconfig-java", Loading
libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/Utils.javadeleted 100644 → 0 +0 −46 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.wm.shell.shared; import android.annotation.NonNull; import java.util.function.Supplier; /** * This class provides generic utility methods and classes for shell */ public class Utils { /** * Lazily returns object from a supplier with caching * @param <T> type of object to get */ public static class Lazy<T> { private T mInstance; /** * @param supplier the supplier that defines the return value if not defined already * @return the cached value or the value from the supplier */ public final T get(@NonNull Supplier<T> supplier) { if (mInstance == null) { mInstance = supplier.get(); } return mInstance; } } }
libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeStatus.java +3 −20 Original line number Diff line number Diff line Loading @@ -16,19 +16,14 @@ package com.android.wm.shell.shared.desktopmode; import static android.hardware.devicestate.DeviceState.PROPERTY_FOLDABLE_DISPLAY_CONFIGURATION_INNER_PRIMARY; import static android.hardware.devicestate.DeviceState.PROPERTY_FOLDABLE_DISPLAY_CONFIGURATION_OUTER_PRIMARY; import android.annotation.NonNull; import android.content.Context; import android.hardware.devicestate.DeviceStateManager; import android.os.SystemProperties; import android.window.DesktopModeFlags; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.window.flags.Flags; import com.android.wm.shell.shared.Utils.Lazy; import java.io.PrintWriter; Loading @@ -40,8 +35,6 @@ public class DesktopModeStatus { private static final String TAG = "DesktopModeStatus"; private static Lazy<Boolean> sIsFoldableDevice = new Lazy<>(); /** * Flag to indicate whether task resizing is veiled. */ Loading Loading @@ -202,7 +195,8 @@ public class DesktopModeStatus { * necessarily enabling desktop mode */ public static boolean overridesShowAppHandle(@NonNull Context context) { return Flags.showAppHandleLargeScreens() && isDeviceFoldable(context); return Flags.showAppHandleLargeScreens() && context.getResources().getBoolean(R.bool.config_enableAppHandle); } /** Loading Loading @@ -249,17 +243,6 @@ public class DesktopModeStatus { return !enforceDeviceRestrictions() || isDesktopModeSupported(context); } /** * @return {@code true} if this is a foldable device */ private static boolean isDeviceFoldable(@NonNull Context context) { return sIsFoldableDevice.get(() -> context.getSystemService(DeviceStateManager.class) .getSupportedDeviceStates().stream().anyMatch(state -> state.hasProperty(PROPERTY_FOLDABLE_DISPLAY_CONFIGURATION_OUTER_PRIMARY) || state.hasProperty( PROPERTY_FOLDABLE_DISPLAY_CONFIGURATION_INNER_PRIMARY))); } /** * Return {@code true} if a display should enter desktop mode by default when the windowing mode * of the display's root [TaskDisplayArea] is set to WINDOWING_MODE_FREEFORM. Loading Loading @@ -300,6 +283,6 @@ public class DesktopModeStatus { pw.println(maxTaskLimitHandle == null ? "null" : maxTaskLimitHandle.getInt(/* def= */ -1)); pw.print(innerPrefix); pw.print("showAppHandle config override="); pw.print(overridesShowAppHandle(context)); pw.print(context.getResources().getBoolean(R.bool.config_enableAppHandle)); } }