Merge "Make new task follow source task root" into sc-v2-dev

This commit is contained in:
Tony Huang
2021-10-19 05:34:11 +00:00
committed by Android (Google) Code Review
2 changed files with 10 additions and 3 deletions

View File

@@ -2737,9 +2737,11 @@ class ActivityStarter {
// If it exist, we need to reparent target root task from TDA to launch root task. // If it exist, we need to reparent target root task from TDA to launch root task.
final TaskDisplayArea tda = mTargetRootTask.getDisplayArea(); final TaskDisplayArea tda = mTargetRootTask.getDisplayArea();
final Task launchRootTask = tda.getLaunchRootTask(mTargetRootTask.getWindowingMode(), final Task launchRootTask = tda.getLaunchRootTask(mTargetRootTask.getWindowingMode(),
mTargetRootTask.getActivityType(), null /** options */, null /** sourceTask */, mTargetRootTask.getActivityType(), null /** options */,
0 /** launchFlags */); mSourceRootTask, 0 /** launchFlags */);
if (launchRootTask != null && launchRootTask != mTargetRootTask) { // If target root task is created by organizer, let organizer handle reparent itself.
if (!mTargetRootTask.mCreatedByOrganizer && launchRootTask != null
&& launchRootTask != mTargetRootTask) {
mTargetRootTask.reparent(launchRootTask, POSITION_TOP); mTargetRootTask.reparent(launchRootTask, POSITION_TOP);
mTargetRootTask = launchRootTask; mTargetRootTask = launchRootTask;
} }

View File

@@ -1275,6 +1275,11 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
} }
} }
} }
// For better split UX, If task launch by the source task which root task is created by
// organizer, it should also launch in that root too.
if (sourceTask != null && sourceTask.getRootTask().mCreatedByOrganizer) {
return sourceTask.getRootTask();
}
return null; return null;
} }