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
2024-08-08 00:35:52 -07:00
parent acf4cd1163
commit fd9056cab4
2 changed files with 19 additions and 5 deletions
@@ -54,6 +54,7 @@ import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.quickstep.util.DesktopTask;
import com.android.quickstep.util.GroupTask;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
import java.util.HashMap;
@@ -213,9 +214,16 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
resources.getString(R.string.quick_switch_desktop),
Locale.getDefault()).format(args));
} else {
final boolean firstTaskIsLeftTopTask =
groupTask.mSplitBounds == null
|| groupTask.mSplitBounds.leftTopTaskId == groupTask.task1.key.id;
final Task leftTopTask = firstTaskIsLeftTopTask
? groupTask.task1 : groupTask.task2;
final Task rightBottomTask = firstTaskIsLeftTopTask
? groupTask.task2 : groupTask.task1;
currentTaskView.setThumbnails(
groupTask.task1,
groupTask.task2,
leftTopTask,
rightBottomTask,
updateTasks ? mViewCallbacks::updateThumbnailInBackground : null,
updateTasks ? mViewCallbacks::updateIconInBackground : null);
}