Merge "Consider the source task while evaluating the launch-root-task" into sc-v2-dev am: cec3c3cbb4

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

Change-Id: Ibbece2115231a2cdc087c9366c6255f1d1abcd6f
This commit is contained in:
TreeHugger Robot
2021-09-29 06:01:25 +00:00
committed by Automerger Merge Worker

View File

@@ -1336,12 +1336,11 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
for (int i = mLaunchRootTasks.size() - 1; i >= 0; --i) {
if (mLaunchRootTasks.get(i).contains(windowingMode, activityType)) {
final Task launchRootTask = mLaunchRootTasks.get(i).task;
// Return the focusable root task for improving the UX with staged split screen.
final TaskFragment adjacentTaskFragment = launchRootTask != null
? launchRootTask.getAdjacentTaskFragment() : null;
final Task adjacentRootTask =
adjacentTaskFragment != null ? adjacentTaskFragment.asTask() : null;
if (adjacentRootTask != null && adjacentRootTask.isFocusedRootTaskOnDisplay()) {
if (sourceTask != null && sourceTask.getRootTask() == adjacentRootTask) {
return adjacentRootTask;
} else {
return launchRootTask;