Fixes two bugs with findLastActiveTasksAndRunCallback()

This CL changes findLastActiveTasksAndRunCallback to return a fixed array rather than an ArrayList.

1) This fixes a (minor) crash with app pairs, where we performed get(0) on an empty array when no running tasks were found.
2) This also fixes a live bug where app pairs would launch apps in the wrong order if app 1 was not found in running tasks, but app 2 was.

The function should be more robust now, preserving the indexing of the input keys.

Fixes: 316053131
Test: Clear all tasks from Overview, launch an app pair, launch succeeds
Flag: ACONFIG com.android.wm.shell.enable_app_pairs DEVELOPMENT
Change-Id: I51d8ba823a2ec57e9ecfeede956e0afce1d653f4
This commit is contained in:
Jeremy Sim committed 2023-12-18 11:39:33 +09:00
1 parent ea4c701579
commit 42a44d7984
6 files changed
+30 -27

No files matched your search

@@ -1125,7 +1125,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
componentKeys,
findExactPairMatch,
foundTasks -> {
@Nullable Task foundTask = foundTasks.get(0);
@Nullable Task foundTask = foundTasks[0];
if (foundTask != null) {
TaskView foundTaskView = recents.getTaskViewByTaskId(foundTask.key.id);
if (foundTaskView != null