Merge "Support to launch the matching task into a closer adjacent target task" into tm-qpr-dev am: e6834970ac am: 090df6281f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18485559

Change-Id: I688cea3fc736ad856f1410c967a3ec918353c03d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2022-05-23 14:49:51 +00:00
committed by Automerger Merge Worker

View File

@@ -2754,17 +2754,15 @@ class ActivityStarter {
mTargetRootTask = getOrCreateRootTask(mStartActivity, mLaunchFlags, intentTask,
mOptions);
}
} else {
// If a launch target indicated, and the matching task is already in the adjacent task
// of the launch target. Adjust to use the adjacent task as its launch target. So the
// existing task will be launched into the closer one and won't be reparent redundantly.
// TODO(b/231541706): Migrate the logic to wm-shell after having proper APIs to help
// resolve target task without actually starting the activity.
final Task adjacentTargetTask = mTargetRootTask.getAdjacentTaskFragment() != null
? mTargetRootTask.getAdjacentTaskFragment().asTask() : null;
if (adjacentTargetTask != null && intentActivity.isDescendantOf(adjacentTargetTask)) {
mTargetRootTask = adjacentTargetTask;
}
}
// If the matching task is already in the adjacent task of the launch target. Adjust to use
// the adjacent task as its launch target. So the existing task will be launched into the
// closer one and won't be reparent redundantly.
final Task adjacentTargetTask = mTargetRootTask.getAdjacentTaskFragment() != null
? mTargetRootTask.getAdjacentTaskFragment().asTask() : null;
if (adjacentTargetTask != null && intentActivity.isDescendantOf(adjacentTargetTask)) {
mTargetRootTask = adjacentTargetTask;
}
// If the target task is not in the front, then we need to bring it to the front...