Merge "Fix bug with trying to split an app with itself" into tm-qpr-dev am: 5107dff0eb

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/21152798

Change-Id: I8f102c0c6a0bc14ba9a4cd47f966a656acca194a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2023-02-01 00:10:55 +00:00
committed by Automerger Merge Worker

View File

@@ -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);
}
);
}