Start activity with focus root task for staged split
During the start activity process, the system will get a launch root
task to launch activity. The root tasks are created as a direct child
of a TDA, unless there is a launch-root-task set where the created
task would be a child task of the launch-root-task.
This CL make activity can start with a focus root task which is
created by the task organizer and has an adjacent task. For
legacy split screens, this CL doesn't change the original behavior.
Bug: 180079028
Test: atest MultiWindowTests
atest TaskDisplayAreaTests
Change-Id: Idf62ec2489eb1f05baddd3b527a0afc868426251
This commit is contained in:
@@ -1274,7 +1274,15 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
|
||||
|
||||
for (int i = mLaunchRootTasks.size() - 1; i >= 0; --i) {
|
||||
if (mLaunchRootTasks.get(i).contains(windowingMode, activityType)) {
|
||||
return mLaunchRootTasks.get(i).task;
|
||||
final Task launchRootTask = mLaunchRootTasks.get(i).task;
|
||||
// Return the focusable root task for improving the UX with staged split screen.
|
||||
final Task adjacentRootTask = launchRootTask != null
|
||||
? launchRootTask.mAdjacentTask : null;
|
||||
if (adjacentRootTask != null && adjacentRootTask.isFocusedRootTaskOnDisplay()) {
|
||||
return adjacentRootTask;
|
||||
} else {
|
||||
return launchRootTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -100,6 +100,29 @@ public class TaskDisplayAreaTests extends WindowTestsBase {
|
||||
assertNull(actualRootTask);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getLaunchRootTask_checksFocusedRootTask() {
|
||||
final TaskDisplayArea taskDisplayArea = mRootWindowContainer.getDefaultTaskDisplayArea();
|
||||
final Task rootTask = createTaskWithActivity(
|
||||
taskDisplayArea,
|
||||
WINDOWING_MODE_MULTI_WINDOW, ACTIVITY_TYPE_STANDARD, ON_TOP, true);
|
||||
rootTask.mCreatedByOrganizer = true;
|
||||
|
||||
final Task adjacentRootTask = createTask(
|
||||
mDisplayContent, WINDOWING_MODE_MULTI_WINDOW, ACTIVITY_TYPE_STANDARD);
|
||||
adjacentRootTask.mCreatedByOrganizer = true;
|
||||
adjacentRootTask.mAdjacentTask = rootTask;
|
||||
rootTask.mAdjacentTask = adjacentRootTask;
|
||||
|
||||
taskDisplayArea.setLaunchRootTask(rootTask,
|
||||
new int[]{WINDOWING_MODE_MULTI_WINDOW}, new int[]{ACTIVITY_TYPE_STANDARD});
|
||||
|
||||
Task actualRootTask = taskDisplayArea.getLaunchRootTask(
|
||||
WINDOWING_MODE_MULTI_WINDOW, ACTIVITY_TYPE_STANDARD, null /* options */,
|
||||
null /* sourceTask */, 0 /*launchFlags*/);
|
||||
assertTrue(actualRootTask.isFocusedRootTaskOnDisplay());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getLaunchRootTask_fromLaunchAdjacentFlagRoot_checksAdjacentRoot() {
|
||||
final ActivityRecord activity = createNonAttachedActivityRecord(mDisplayContent);
|
||||
|
||||
Reference in New Issue
Block a user