summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2023-01-31 23:42:29 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2023-01-31 23:42:29 +0000
commit5107dff0eb187a17ca934e9b6535d7a072984435 (patch)
tree81a4c92404039cb210073caaa92541e6bdf50803
parent2eacb5c601ff8cd45160617d8fe2910d2b05d6ca (diff)
parentc779ae54cefbfcb26258ab3067ce36ce7d18abbd (diff)
downloadLauncher3-5107dff0eb187a17ca934e9b6535d7a072984435.tar.gz
Merge "Fix bug with trying to split an app with itself" into tm-qpr-dev
-rw-r--r--quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java42
1 files changed, 25 insertions, 17 deletions
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
index 1c11bf7d3d..b680a1536e 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
@@ -195,24 +195,32 @@ public class TaskbarUIController {
(Consumer<Task>) foundTask -> {
if (foundTask != null) {
TaskView foundTaskView = recents.getTaskViewByTaskId(foundTask.key.id);
- // There is already a running app of this type, use that as second app.
- recents.confirmSplitSelect(
- foundTaskView,
- foundTaskView.getTask(),
- foundTaskView.getIconView().getDrawable(),
- foundTaskView.getThumbnail(),
- foundTaskView.getThumbnail().getThumbnail(),
- null /* intent */);
- } else {
- // No running app of that type, create a new instance as second app.
- recents.confirmSplitSelect(
- null /* containerTaskView */,
- null /* task */,
- new BitmapDrawable(info.bitmap.icon),
- startingView,
- null /* thumbnail */,
- intent);
+ // TODO (b/266482558): This additional null check is needed because there
+ // are times when our Tasks list doesn't match our TaskViews list (like when
+ // a tile is removed during {@link RecentsView#applyLoadPlan()}. A clearer
+ // state management system is in the works so that we don't need to rely on
+ // null checks as much. See comments at ag/21152798.
+ if (foundTaskView != null) {
+ // There is already a running app of this type, use that as second app.
+ recents.confirmSplitSelect(
+ foundTaskView,
+ foundTaskView.getTask(),
+ foundTaskView.getIconView().getDrawable(),
+ foundTaskView.getThumbnail(),
+ foundTaskView.getThumbnail().getThumbnail(),
+ null /* intent */);
+ return;
+ }
}
+
+ // No running app of that type, create a new instance as second app.
+ recents.confirmSplitSelect(
+ null /* containerTaskView */,
+ null /* task */,
+ new BitmapDrawable(info.bitmap.icon),
+ startingView,
+ null /* thumbnail */,
+ intent);
}
);
}