Merge "Use DesktopModeFlags for Alt+Tab CD flags" into main

This commit is contained in:
Treehugger Robot
2025-04-08 10:57:16 -07:00
committed by Android (Google) Code Review
5 changed files with 44 additions and 9 deletions
@@ -15,8 +15,8 @@
*/
package com.android.launcher3.taskbar;
import static com.android.launcher3.Flags.enableAltTabKqsFlatenning;
import static com.android.launcher3.Flags.enableAltTabKqsOnConnectedDisplays;
import static com.android.launcher3.taskbar.TaskbarDesktopModeFlags.enableAltTabKqsFlatenning;
import static com.android.launcher3.taskbar.TaskbarDesktopModeFlags.enableAltTabKqsOnConnectedDisplays;
import android.app.ActivityManager;
import android.content.ComponentName;
@@ -246,7 +246,7 @@ public final class KeyboardQuickSwitchController implements
mHasDesktopTask = false;
mWasDesktopTaskFilteredOut = false;
if (enableAltTabKqsFlatenning()) {
if (enableAltTabKqsFlatenning.isTrue()) {
processLoadedTasksCombined(tasks, taskIdsToExclude);
} else if (mControllers.taskbarDesktopModeController.shouldShowDesktopTasksInTaskbar()) {
processLoadedTasksOnDesktop(tasks, taskIdsToExclude);
@@ -313,7 +313,7 @@ public final class KeyboardQuickSwitchController implements
// multiple desktops flag disabled. So, until multiple desktops is implemented the following
// should help with team-fooding Alt+tab on connected displays. Post multiple desktop,
// further changes maybe required to support launching selected desktops.
if (enableAltTabKqsOnConnectedDisplays()) {
if (enableAltTabKqsOnConnectedDisplays.isTrue()) {
mTasks = desktopTasks.stream()
.flatMap(t -> t.getTasks().stream())
.map(SingleTask::new)
@@ -17,6 +17,8 @@ package com.android.launcher3.taskbar;
import static androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.PARENT_ID;
import static com.android.launcher3.taskbar.TaskbarDesktopModeFlags.enableAltTabKqsFlatenning;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
@@ -47,7 +49,6 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import com.android.app.animation.Interpolators;
import com.android.internal.jank.Cuj;
import com.android.launcher3.Flags;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatedFloat;
@@ -287,7 +288,7 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
} else if (groupTask instanceof SingleTask singleTask) {
task1 = singleTask.getTask();
task2 = null;
} else if (Flags.enableAltTabKqsFlatenning()
} else if (enableAltTabKqsFlatenning.isTrue()
&& groupTask instanceof DesktopTask desktopTask) {
task1 = desktopTask.getTasks().get(0);
task2 = null;
@@ -16,6 +16,7 @@
package com.android.launcher3.taskbar;
import static com.android.launcher3.desktop.DesktopAppLaunchTransition.AppLaunchType.UNMINIMIZE;
import static com.android.launcher3.taskbar.TaskbarDesktopModeFlags.enableAltTabKqsFlatenning;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
@@ -283,7 +284,7 @@ public class KeyboardQuickSwitchViewController {
return -1;
}
if (Flags.enableAltTabKqsFlatenning()
if (enableAltTabKqsFlatenning.isTrue()
&& tryLaunchingCombinedTask(task, slideInTransition, systemUiProxy)) {
return -1;
}
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2025 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.launcher3.taskbar
import android.window.DesktopModeFlags.DesktopModeFlag
import com.android.launcher3.Flags
class TaskbarDesktopModeFlags {
companion object {
@JvmField
val enableAltTabKqsOnConnectedDisplays: DesktopModeFlag =
DesktopModeFlag(Flags::enableAltTabKqsOnConnectedDisplays, false)
@JvmField
val enableAltTabKqsFlatenning: DesktopModeFlag =
DesktopModeFlag(Flags::enableAltTabKqsFlatenning, false)
}
}
@@ -29,6 +29,7 @@ import static com.android.launcher3.Flags.enableOverviewOnConnectedDisplays;
import static com.android.launcher3.LauncherPrefs.backedUpItem;
import static com.android.launcher3.MotionEventsUtils.isTrackpadMotionEvent;
import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe;
import static com.android.launcher3.taskbar.TaskbarDesktopModeFlags.enableAltTabKqsOnConnectedDisplays;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.launcher3.util.OnboardingPrefs.HOME_BOUNCE_SEEN;
@@ -237,7 +238,7 @@ public class TouchInteractionService extends Service {
executeForTouchInteractionService(tis -> {
if (triggeredFromAltTab) {
TaskUtils.closeSystemWindowsAsync(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
int displayId = Flags.enableAltTabKqsOnConnectedDisplays()
int displayId = enableAltTabKqsOnConnectedDisplays.isTrue()
? SystemUiProxy.INSTANCE.get(tis).getFocusState().getFocusedDisplayId()
: DEFAULT_DISPLAY;
tis.mOverviewCommandHelper.addCommand(CommandType.KEYBOARD_INPUT, displayId);
@@ -253,7 +254,7 @@ public class TouchInteractionService extends Service {
executeForTouchInteractionService(tis -> {
if (triggeredFromAltTab && !triggeredFromHomeKey) {
// onOverviewShownFromAltTab hides the overview and ends at the target app
int displayId = Flags.enableAltTabKqsOnConnectedDisplays()
int displayId = enableAltTabKqsOnConnectedDisplays.isTrue()
? SystemUiProxy.INSTANCE.get(tis).getFocusState().getFocusedDisplayId()
: DEFAULT_DISPLAY;
tis.mOverviewCommandHelper.addCommand(CommandType.HIDE, displayId);