Merge "Revert "Enable app handle on foldables"" into main
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 45d0c90..390fbea 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -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>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index bdf579d..2671ff9 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -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" />
diff --git a/libs/WindowManager/Shell/shared/Android.bp b/libs/WindowManager/Shell/shared/Android.bp
index 5bbda95..5113d98 100644
--- a/libs/WindowManager/Shell/shared/Android.bp
+++ b/libs/WindowManager/Shell/shared/Android.bp
@@ -26,7 +26,6 @@
name: "wm_shell-shared-utils",
srcs: [
"src/com/android/wm/shell/shared/TransitionUtil.java",
- "src/com/android/wm/shell/shared/Utils.java",
],
}
@@ -72,7 +71,6 @@
srcs: [
"**/desktopmode/*.java",
"**/desktopmode/*.kt",
- ":wm_shell-shared-utils",
],
static_libs: [
"com.android.window.flags.window-aconfig-java",
diff --git a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/Utils.java b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/Utils.java
deleted file mode 100644
index f5e6ddd..0000000
--- a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/Utils.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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;
- }
- }
-}
diff --git a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeStatus.java b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeStatus.java
index 4c6ef93..04c17e5 100644
--- a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeStatus.java
+++ b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeStatus.java
@@ -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;
@@ -40,8 +35,6 @@
private static final String TAG = "DesktopModeStatus";
- private static Lazy<Boolean> sIsFoldableDevice = new Lazy<>();
-
/**
* Flag to indicate whether task resizing is veiled.
*/
@@ -202,7 +195,8 @@
* 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);
}
/**
@@ -250,17 +244,6 @@
}
/**
- * @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.
*/
@@ -300,6 +283,6 @@
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));
}
}