Filter out running pinned app tasks from KeyboardQuickSwitch.

- Opening KQS from keyboard shortcuts shows all the tasks.
- Opening KQS from taskbar will filter out all the running pinned apps
  from the list of views.

Bug: 368119679
Change-Id: I6090679f9fc359212db00a325917892ae6e1eb39
Test: open KQS via taskbar affordance, obseerve filtered list,
      use alt + option
      observe list changes to show all tasks
      click affordance again, observe list changes back to filtered
Flag: com.android.launcher3.taskbar_overflow
This commit is contained in:
Jon Miranda
2024-09-25 15:35:05 +00:00
parent 8388a07673
commit 9ce27637d7
3 changed files with 59 additions and 9 deletions
@@ -18,6 +18,7 @@ package com.android.launcher3.taskbar;
import static com.android.app.animation.Interpolators.FINAL_FRAME;
import static com.android.app.animation.Interpolators.LINEAR;
import static com.android.launcher3.Flags.enableScalingRevealHomeAnimation;
import static com.android.launcher3.Flags.taskbarOverflow;
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA;
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X;
@@ -81,6 +82,9 @@ import com.android.wm.shell.Flags;
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
import java.io.PrintWriter;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
@@ -629,6 +633,24 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
}
}
/**
* @return A set of Task ids of running apps that are pinned in the taskbar.
*/
protected Set<Integer> getTaskIdsForPinnedApps() {
if (!taskbarOverflow()) {
return Collections.emptySet();
}
Set<Integer> pinnedAppsWithTasks = new HashSet<>();
for (View iconView : getIconViews()) {
if (iconView instanceof BubbleTextView btv
&& btv.getTag() instanceof TaskItemInfo itemInfo) {
pinnedAppsWithTasks.add(itemInfo.getTaskId());
}
}
return pinnedAppsWithTasks;
}
private BubbleTextView.RunningAppState getRunningAppState(
BubbleTextView btv,
Set<Integer> runningTaskIds,