Support alt+tab for desktop tasks

Updates keyboard quickswitch logic handle quickswitching while on
desktop. When on desktop, alt+tab moves only between desktop tasks.
Fullscreen tasks are shown in the overflow tile and can be accessed by
going to overview.

TODO:
- when not in desktop and using quickswitch, show the desktop tile as a
  combined tile in the row, similar to what is shown in overview

Flag: persist.wm.debug.desktop_mode_2
Bug: 280468885
Test: open some apps on desktop and have some fullscreen apps opened in
  the background, when on desktop, observe that alt+tab only switches
  between desktop tasks
Test: same setup, but switch to a fullscreen app, observe that alt+tab
  only switches between fullscreen tasks and desktop is accessible from
  overview

Change-Id: Ib19f2eaa24363bbd0669c8c8c3d99ed9d9118a17
This commit is contained in:
Ats Jenk
2023-05-18 09:07:04 -07:00
parent 7bae2b82ef
commit 3067874559
7 changed files with 100 additions and 19 deletions

View File

@@ -27,6 +27,7 @@ import androidx.annotation.Nullable;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayDragLayer;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.util.GroupTask;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -52,6 +53,8 @@ public class KeyboardQuickSwitchViewController {
private int mCurrentFocusIndex = -1;
private boolean mOnDesktop;
protected KeyboardQuickSwitchViewController(
@NonNull TaskbarControllers controllers,
@NonNull TaskbarOverlayContext overlayContext,
@@ -71,10 +74,12 @@ public class KeyboardQuickSwitchViewController {
@NonNull List<GroupTask> tasks,
int numHiddenTasks,
boolean updateTasks,
int currentFocusIndexOverride) {
int currentFocusIndexOverride,
boolean onDesktop) {
TaskbarOverlayDragLayer dragLayer = mOverlayContext.getDragLayer();
dragLayer.addView(mKeyboardQuickSwitchView);
dragLayer.runOnClickOnce(v -> closeQuickSwitchView(true));
mOnDesktop = onDesktop;
mKeyboardQuickSwitchView.applyLoadPlan(
mOverlayContext,
@@ -136,6 +141,10 @@ public class KeyboardQuickSwitchViewController {
GroupTask task = mControllerCallbacks.getTaskAt(index);
if (task == null) {
return Math.max(0, index);
} else if (mOnDesktop) {
UI_HELPER_EXECUTOR.execute(() ->
SystemUiProxy.INSTANCE.get(mKeyboardQuickSwitchView.getContext())
.showDesktopApp(task.task1.key.id));
} else if (task.task2 == null) {
UI_HELPER_EXECUTOR.execute(() ->
ActivityManagerWrapper.getInstance().startActivityFromRecents(