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

Commit 9c0392e0 authored by Orhan Uysal's avatar Orhan Uysal
Browse files

Fix filtering of DesktopTaskViews

When finding last active tasks we didn't account for the fact that there
could be more than 2 tasks in a GroupTask. This cl fixes that so it
finds the correct last active tasks in desktop cases.

Also make sure that if a  DesktopTaskView is found, we don't launch it
through TaskView#LaunchTasks to create a transition that we can handle
in WM Shell.

Fix: 327447672
Fix: 354171747
Flag: EXEMPT Bugfix
Test: atest SplitSelectStateControllerTest
Change-Id: I71cc630a79f23e5eaad10b3c2284496422ce6994
parent acc4a81a
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -140,6 +140,7 @@ import com.android.quickstep.RecentsModel;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.util.DesktopTask;
import com.android.quickstep.util.GroupTask;
import com.android.quickstep.views.DesktopTaskView;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.recents.model.Task;
@@ -1357,7 +1358,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
                    if (foundTask != null) {
                        TaskView foundTaskView = recents.getTaskViewByTaskId(foundTask.key.id);
                        if (foundTaskView != null
                                && foundTaskView.isVisibleToUser()) {
                                && foundTaskView.isVisibleToUser()
                                && !(foundTaskView instanceof DesktopTaskView)) {
                            TestLogging.recordEvent(
                                    TestProtocol.SEQUENCE_MAIN, "start: taskbarAppIcon");
                            foundTaskView.launchTasks();
@@ -1408,7 +1410,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
                        return;
                    }
                }

                startActivity(intent);
            } else {
                getSystemService(LauncherApps.class).startMainActivity(
+8 −10
Original line number Diff line number Diff line
@@ -276,17 +276,15 @@ public class SplitSelectStateController {
                    // Loop through tasks in reverse, since they are ordered with recent tasks last
                    for (int j = taskGroups.size() - 1; j >= 0; j--) {
                        GroupTask groupTask = taskGroups.get(j);
                        Task task1 = groupTask.task1;
                        // Don't add duplicate Tasks
                        if (isInstanceOfComponent(task1, key)
                                && !Arrays.asList(lastActiveTasks).contains(task1)) {
                            lastActiveTask = task1;
                        // Account for desktop cases where there can be N tasks in the group
                        for (Task task : groupTask.getTasks()) {
                            if (isInstanceOfComponent(task, key)
                                    && !Arrays.asList(lastActiveTasks).contains(task)) {
                                lastActiveTask = task;
                                break;
                            }
                        Task task2 = groupTask.task2;
                        if (isInstanceOfComponent(task2, key)
                                && !Arrays.asList(lastActiveTasks).contains(task2)) {
                            lastActiveTask = task2;
                        }
                        if (lastActiveTask != null) {
                            break;
                        }
                    }