mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 23:36:47 +00:00
[2/n] Unify DesktopModeStatus between Shell and Sysui
Remove `DesktopModeStatus` from quickstep and instead access through shell/shared to shell/shared. Flag: None Bug: 335401172 Test: atest -c NexusLauncherTests:com.android.quickstep.DesktopSystemShortcutTest Change-Id: I42f8b6e5f97f13fda22ed34bda4aa712ead53349
This commit is contained in:
@@ -1,58 +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.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));
|
||||
}
|
||||
}
|
||||
@@ -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(
|
||||
|
||||
@@ -168,7 +168,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;
|
||||
@@ -216,6 +215,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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user