Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c25c3a1 authored by Ats Jenk's avatar Ats Jenk
Browse files

Use aconfig flag for desktop mode

Refactors all flag access in Launcher to be from DesktopTaskView and using a method instead of a static field.
Also using static import for the method so if we need to move it, only imports needs to be updated.

Bug: 304778354
Flag: ACONFIG com.android.wm.shell.enable_desktop_windowing TEAMFOOD
Test: enable the aconfig flag, check that desktop windowing is available

Change-Id: Ia2bdfd865802a635878d72cfb5a90c21dad6ed08
parent 24231d99
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.launcher3.statehandlers;

import static com.android.launcher3.LauncherState.BACKGROUND_APP;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported;

import android.os.Debug;
import android.os.SystemProperties;
@@ -105,13 +106,6 @@ public class DesktopVisibilityController {
        SystemUiProxy.INSTANCE.get(mLauncher).setDesktopTaskListener(null);
    }

    /**
     * Whether desktop mode is supported.
     */
    private boolean isDesktopModeSupported() {
        return SystemProperties.getBoolean("persist.wm.debug.desktop_mode_2", false);
    }

    /**
     * Whether freeform windows are visible in desktop mode.
     */
+4 −3
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package com.android.launcher3.taskbar;

import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported;

import android.content.ComponentName;
import android.content.pm.ActivityInfo;

@@ -28,7 +30,6 @@ import com.android.quickstep.LauncherActivityInterface;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.util.DesktopTask;
import com.android.quickstep.util.GroupTask;
import com.android.quickstep.views.DesktopTaskView;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;

@@ -109,7 +110,7 @@ public final class KeyboardQuickSwitchController implements
        DesktopVisibilityController desktopController =
                LauncherActivityInterface.INSTANCE.getDesktopVisibilityController();
        final boolean onDesktop =
                DesktopTaskView.DESKTOP_MODE_SUPPORTED
                isDesktopModeSupported()
                        && desktopController != null
                        && desktopController.areFreeformTasksVisible();

@@ -136,7 +137,7 @@ public final class KeyboardQuickSwitchController implements

        // Hide all desktop tasks and show them on the hidden tile
        int hiddenDesktopTasks = 0;
        if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) {
        if (isDesktopModeSupported()) {
            DesktopTask desktopTask = findDesktopTask(tasks);
            if (desktopTask != null) {
                hiddenDesktopTasks = desktopTask.tasks.size();
+2 −2
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_IME_SWITCHER_BUTTON_TAP;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_OVERVIEW_BUTTON_LONGPRESS;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_OVERVIEW_BUTTON_TAP;
import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
@@ -52,7 +53,6 @@ import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.TaskUtils;
import com.android.quickstep.TouchInteractionService;
import com.android.quickstep.util.AssistUtils;
import com.android.quickstep.views.DesktopTaskView;

import java.io.PrintWriter;
import java.lang.annotation.Retention;
@@ -274,7 +274,7 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
    private void navigateHome() {
        TaskUtils.closeSystemWindowsAsync(CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY);

        if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) {
        if (isDesktopModeSupported()) {
            DesktopVisibilityController desktopVisibilityController =
                    LauncherActivityInterface.INSTANCE.getDesktopVisibilityController();
            if (desktopVisibilityController != null) {
+4 −5
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.os.Trace.TRACE_TAG_APP;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_OPTIMIZE_MEASURE;
import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED;

import static com.android.app.animation.Interpolators.EMPHASIZED;
import static com.android.launcher3.LauncherSettings.Animation.DEFAULT_NO_ICON;
import static com.android.launcher3.LauncherSettings.Animation.VIEW_BACKGROUND;
@@ -51,6 +50,7 @@ import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN;
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.quickstep.util.SplitAnimationTimings.TABLET_HOME_TO_SPLIT;
import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY;
import static com.android.wm.shell.common.split.SplitScreenConstants.SNAP_TO_50_50;

@@ -164,7 +164,6 @@ import com.android.quickstep.util.SplitSelectStateController;
import com.android.quickstep.util.SplitToWorkspaceController;
import com.android.quickstep.util.SplitWithKeyboardShortcutController;
import com.android.quickstep.util.TISBindHelper;
import com.android.quickstep.views.DesktopTaskView;
import com.android.quickstep.views.FloatingTaskView;
import com.android.quickstep.views.OverviewActionsView;
import com.android.quickstep.views.RecentsView;
@@ -246,7 +245,7 @@ public class QuickstepLauncher extends Launcher {
                        getDepthController(), getStatsLogManager(),
                        systemUiProxy, RecentsModel.INSTANCE.get(this),
                        () -> onStateBack());
        if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) {
        if (isDesktopModeSupported()) {
            mDesktopRecentsTransitionController = new DesktopRecentsTransitionController(
                    getStateManager(), systemUiProxy, getIApplicationThread(),
                    getDepthController());
@@ -272,7 +271,7 @@ public class QuickstepLauncher extends Launcher {
        mTISBindHelper = new TISBindHelper(this, this::onTISConnected);
        mDepthController = new DepthController(this);
        mDesktopVisibilityController = new DesktopVisibilityController(this);
        if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) {
        if (isDesktopModeSupported()) {
            mDesktopVisibilityController.registerSystemUiListener();
            mSplitSelectStateController.initSplitFromDesktopController(this);
        }
@@ -889,7 +888,7 @@ public class QuickstepLauncher extends Launcher {

    @Override
    public void setResumed() {
        if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) {
        if (isDesktopModeSupported()) {
            DesktopVisibilityController controller = mDesktopVisibilityController;
            if (controller != null && controller.areFreeformTasksVisible()
                    && !controller.isRecentsGestureInProgress()) {
+2 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.launcher3.uioverrides.states;

import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND;
import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITIONS;
import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported;

import android.content.Context;
import android.graphics.Color;
@@ -26,7 +27,6 @@ import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.views.DesktopTaskView;
import com.android.quickstep.views.RecentsView;

/**
@@ -90,7 +90,7 @@ public class BackgroundAppState extends OverviewState {

    @Override
    protected float getDepthUnchecked(Context context) {
        if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) {
        if (isDesktopModeSupported()) {
            if (Launcher.getLauncher(context).areFreeformTasksVisible()) {
                // Don't blur the background while freeform tasks are visible
                return 0;
Loading