Loading libs/WindowManager/Shell/shared/Android.bp +0 −1 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 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 to use, when the instance has not yet been initialized * @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 +8 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.wm.shell.shared.desktopmode; import static android.hardware.display.DisplayManager.DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.hardware.display.DisplayManager; import android.os.SystemProperties; Loading @@ -29,7 +30,6 @@ 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; import java.util.Arrays; Loading @@ -42,7 +42,8 @@ public class DesktopModeStatus { private static final String TAG = "DesktopModeStatus"; private static Lazy<Boolean> sIsLargeScreenDevice = new Lazy<>(); @Nullable private static Boolean sIsLargeScreenDevice = null; /** * Flag to indicate whether task resizing is veiled. Loading Loading @@ -287,12 +288,15 @@ public class DesktopModeStatus { * @return {@code true} if this device has an internal large screen */ private static boolean deviceHasLargeScreen(@NonNull Context context) { return sIsLargeScreenDevice.get(() -> Arrays.stream( if (sIsLargeScreenDevice == null) { sIsLargeScreenDevice = Arrays.stream( context.getSystemService(DisplayManager.class) .getDisplays(DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED)) .filter(display -> display.getType() == Display.TYPE_INTERNAL) .anyMatch(display -> display.getMinSizeDimensionDp() >= WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP)); >= WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP); } return sIsLargeScreenDevice; } /** Loading Loading
libs/WindowManager/Shell/shared/Android.bp +0 −1 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
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 to use, when the instance has not yet been initialized * @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 +8 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.wm.shell.shared.desktopmode; import static android.hardware.display.DisplayManager.DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.hardware.display.DisplayManager; import android.os.SystemProperties; Loading @@ -29,7 +30,6 @@ 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; import java.util.Arrays; Loading @@ -42,7 +42,8 @@ public class DesktopModeStatus { private static final String TAG = "DesktopModeStatus"; private static Lazy<Boolean> sIsLargeScreenDevice = new Lazy<>(); @Nullable private static Boolean sIsLargeScreenDevice = null; /** * Flag to indicate whether task resizing is veiled. Loading Loading @@ -287,12 +288,15 @@ public class DesktopModeStatus { * @return {@code true} if this device has an internal large screen */ private static boolean deviceHasLargeScreen(@NonNull Context context) { return sIsLargeScreenDevice.get(() -> Arrays.stream( if (sIsLargeScreenDevice == null) { sIsLargeScreenDevice = Arrays.stream( context.getSystemService(DisplayManager.class) .getDisplays(DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED)) .filter(display -> display.getType() == Display.TYPE_INTERNAL) .anyMatch(display -> display.getMinSizeDimensionDp() >= WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP)); >= WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP); } return sIsLargeScreenDevice; } /** Loading