Check for leftTopTask and rightBottomTask in KQS.

KQS currently always take the GroupTask's taskId1 and taskId2 as
leftTop/rightBottom, in that order. However, sometimes it is possible
that the order is flipped; RecentTasksController#getRecentTasks return a
list of tasks base on recency, and it is possible that when it
initializes a new GroupTask, it put leftBottom as task2 and vice versa,
completely dependent on how they are processed. This CL uses
GroupTask#mSplitBounds as the source of truth to see

1) Which leftTop/rightBottom to draw for the thumbnail and
2) Which task is leftTop, which task is rightBottom, for re-launching

Bug: 328691131
Test: Manually; using KQS, no longer see the app in the wrong places
Flag: EXEMPT bugfix
Change-Id: I14b3becb05359a917372ec2d7d80d32190f0f96b
This commit is contained in:
Ben Lin committed 2024-08-12 13:33:35 -07:00
1 parent acf4cd1163
commit fd9056cab4
2 files changed
+19 -5

No files matched your search

@@ -1382,10 +1382,11 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer
*/
public void launchSplitTasks(
@NonNull GroupTask groupTask, @Nullable RemoteTransition remoteTransition) {
// Top/left and bottom/right tasks respectively.
Task task1 = groupTask.task1;
// SplitBounds can be null if coming from Taskbar launch.
final boolean firstTaskIsLeftTopTask = isFirstTaskLeftTopTask(groupTask);
// task2 should never be null when calling this method. Allow a crash to catch invalid calls
Task task2 = groupTask.task2;
Task task1 = firstTaskIsLeftTopTask ? groupTask.task1 : groupTask.task2;
Task task2 = firstTaskIsLeftTopTask ? groupTask.task2 : groupTask.task1;
mSplitSelectStateController.launchExistingSplitPair(
null /* launchingTaskView */,
task1.key.id,
@@ -1399,6 +1400,11 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer
remoteTransition);
}
private static boolean isFirstTaskLeftTopTask(@NonNull GroupTask groupTask) {
return groupTask.mSplitBounds == null
|| groupTask.mSplitBounds.leftTopTaskId == groupTask.task1.key.id;
}
/**
* Launches two apps as an app pair.
*/