Loading quickstep/src/com/android/quickstep/DesktopModeStatus.javadeleted 100644 → 0 +0 −58 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.quickstep; import android.content.Context; import android.os.SystemProperties; import com.android.internal.annotations.VisibleForTesting; import com.android.window.flags.Flags; // TODO(b/335401172): Explore unifying logic across core and shell public class DesktopModeStatus { /** * 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); /** * Return {@code true} if desktop mode should be restricted to supported devices. */ @VisibleForTesting public static boolean enforceDeviceRestrictions() { return ENFORCE_DEVICE_RESTRICTIONS; } /** * Return {@code true} if the current device supports desktop mode. */ @VisibleForTesting public static boolean isDesktopModeSupported(Context context) { return context.getResources().getBoolean( com.android.internal.R.bool.config_isDesktopModeSupported); } /** * Return {@code true} if desktop mode can be entered on the current device. */ public static boolean canEnterDesktopMode(Context context) { return Flags.enableDesktopWindowingMode() && (!enforceDeviceRestrictions() || isDesktopModeSupported(context)); } } quickstep/src/com/android/quickstep/DesktopSystemShortcut.kt +1 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import com.android.launcher3.popup.SystemShortcut import com.android.quickstep.views.RecentsView import com.android.quickstep.views.RecentsViewContainer import com.android.quickstep.views.TaskView.TaskContainer import com.android.wm.shell.shared.DesktopModeStatus /** A menu item, "Desktop", that allows the user to bring the current app into Desktop Windowing. */ class DesktopSystemShortcut( Loading quickstep/src/com/android/quickstep/views/RecentsView.java +1 −1 Original line number Diff line number Diff line Loading @@ -170,7 +170,6 @@ import com.android.launcher3.util.TranslateEdgeEffect; import com.android.launcher3.util.VibratorWrapper; import com.android.launcher3.util.ViewPool; import com.android.quickstep.BaseContainerInterface; import com.android.quickstep.DesktopModeStatus; import com.android.quickstep.GestureState; import com.android.quickstep.OverviewCommandHelper; import com.android.quickstep.RecentsAnimationController; Loading Loading @@ -218,6 +217,7 @@ import com.android.systemui.shared.system.PackageManagerWrapper; import com.android.systemui.shared.system.TaskStackChangeListener; import com.android.systemui.shared.system.TaskStackChangeListeners; import com.android.wm.shell.common.pip.IPipAnimationListener; import com.android.wm.shell.shared.DesktopModeStatus; import java.util.ArrayList; import java.util.Arrays; Loading quickstep/tests/src/com/android/quickstep/DesktopSystemShortcutTest.kt +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import com.android.quickstep.views.TaskView import com.android.systemui.shared.recents.model.Task import com.android.systemui.shared.recents.model.Task.TaskKey import com.android.window.flags.Flags import com.android.wm.shell.shared.DesktopModeStatus import com.google.common.truth.Truth.assertThat import org.junit.After import org.junit.Before Loading Loading
quickstep/src/com/android/quickstep/DesktopModeStatus.javadeleted 100644 → 0 +0 −58 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.quickstep; import android.content.Context; import android.os.SystemProperties; import com.android.internal.annotations.VisibleForTesting; import com.android.window.flags.Flags; // TODO(b/335401172): Explore unifying logic across core and shell public class DesktopModeStatus { /** * 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); /** * Return {@code true} if desktop mode should be restricted to supported devices. */ @VisibleForTesting public static boolean enforceDeviceRestrictions() { return ENFORCE_DEVICE_RESTRICTIONS; } /** * Return {@code true} if the current device supports desktop mode. */ @VisibleForTesting public static boolean isDesktopModeSupported(Context context) { return context.getResources().getBoolean( com.android.internal.R.bool.config_isDesktopModeSupported); } /** * Return {@code true} if desktop mode can be entered on the current device. */ public static boolean canEnterDesktopMode(Context context) { return Flags.enableDesktopWindowingMode() && (!enforceDeviceRestrictions() || isDesktopModeSupported(context)); } }
quickstep/src/com/android/quickstep/DesktopSystemShortcut.kt +1 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import com.android.launcher3.popup.SystemShortcut import com.android.quickstep.views.RecentsView import com.android.quickstep.views.RecentsViewContainer import com.android.quickstep.views.TaskView.TaskContainer import com.android.wm.shell.shared.DesktopModeStatus /** A menu item, "Desktop", that allows the user to bring the current app into Desktop Windowing. */ class DesktopSystemShortcut( Loading
quickstep/src/com/android/quickstep/views/RecentsView.java +1 −1 Original line number Diff line number Diff line Loading @@ -170,7 +170,6 @@ import com.android.launcher3.util.TranslateEdgeEffect; import com.android.launcher3.util.VibratorWrapper; import com.android.launcher3.util.ViewPool; import com.android.quickstep.BaseContainerInterface; import com.android.quickstep.DesktopModeStatus; import com.android.quickstep.GestureState; import com.android.quickstep.OverviewCommandHelper; import com.android.quickstep.RecentsAnimationController; Loading Loading @@ -218,6 +217,7 @@ import com.android.systemui.shared.system.PackageManagerWrapper; import com.android.systemui.shared.system.TaskStackChangeListener; import com.android.systemui.shared.system.TaskStackChangeListeners; import com.android.wm.shell.common.pip.IPipAnimationListener; import com.android.wm.shell.shared.DesktopModeStatus; import java.util.ArrayList; import java.util.Arrays; Loading
quickstep/tests/src/com/android/quickstep/DesktopSystemShortcutTest.kt +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import com.android.quickstep.views.TaskView import com.android.systemui.shared.recents.model.Task import com.android.systemui.shared.recents.model.Task.TaskKey import com.android.window.flags.Flags import com.android.wm.shell.shared.DesktopModeStatus import com.google.common.truth.Truth.assertThat import org.junit.After import org.junit.Before Loading