Merge "Prevent reparenting to a fallback target while relaunching a pinned task" into tm-qpr-dev
This commit is contained in:
@@ -1114,7 +1114,10 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
|
|||||||
// If a task is launching from a created-by-organizer task, it should be launched into the
|
// If a task is launching from a created-by-organizer task, it should be launched into the
|
||||||
// same created-by-organizer task as well. Unless, the candidate task is already positioned
|
// same created-by-organizer task as well. Unless, the candidate task is already positioned
|
||||||
// in the another adjacent task.
|
// in the another adjacent task.
|
||||||
if (sourceTask != null) {
|
if (sourceTask != null && (candidateTask == null
|
||||||
|
// A pinned task relaunching should be handled by its task organizer. Skip fallback
|
||||||
|
// launch target of a pinned task from source task.
|
||||||
|
|| candidateTask.getWindowingMode() != WINDOWING_MODE_PINNED)) {
|
||||||
Task launchTarget = sourceTask.getCreatedByOrganizerTask();
|
Task launchTarget = sourceTask.getCreatedByOrganizerTask();
|
||||||
if (launchTarget != null && launchTarget.getAdjacentTaskFragment() != null) {
|
if (launchTarget != null && launchTarget.getAdjacentTaskFragment() != null) {
|
||||||
if (candidateTask != null) {
|
if (candidateTask != null) {
|
||||||
|
|||||||
@@ -762,12 +762,20 @@ public class TaskDisplayAreaTests extends WindowTestsBase {
|
|||||||
Task actualRootTask = taskDisplayArea.getLaunchRootTask(WINDOWING_MODE_UNDEFINED,
|
Task actualRootTask = taskDisplayArea.getLaunchRootTask(WINDOWING_MODE_UNDEFINED,
|
||||||
ACTIVITY_TYPE_STANDARD, null /* options */, adjacentRootTask /* sourceTask */,
|
ACTIVITY_TYPE_STANDARD, null /* options */, adjacentRootTask /* sourceTask */,
|
||||||
0 /* launchFlags */, candidateTask);
|
0 /* launchFlags */, candidateTask);
|
||||||
assertSame(rootTask, actualRootTask.getRootTask());
|
assertSame(rootTask, actualRootTask);
|
||||||
|
|
||||||
// Verify the launch root task without candidate task
|
// Verify the launch root task without candidate task
|
||||||
actualRootTask = taskDisplayArea.getLaunchRootTask(WINDOWING_MODE_UNDEFINED,
|
actualRootTask = taskDisplayArea.getLaunchRootTask(WINDOWING_MODE_UNDEFINED,
|
||||||
ACTIVITY_TYPE_STANDARD, null /* options */, adjacentRootTask /* sourceTask */,
|
ACTIVITY_TYPE_STANDARD, null /* options */, adjacentRootTask /* sourceTask */,
|
||||||
0 /* launchFlags */);
|
0 /* launchFlags */);
|
||||||
assertSame(adjacentRootTask, actualRootTask.getRootTask());
|
assertSame(adjacentRootTask, actualRootTask);
|
||||||
|
|
||||||
|
final Task pinnedTask = createTask(
|
||||||
|
mDisplayContent, WINDOWING_MODE_PINNED, ACTIVITY_TYPE_STANDARD);
|
||||||
|
// Verify not adjusting launch target for pinned candidate task
|
||||||
|
actualRootTask = taskDisplayArea.getLaunchRootTask(WINDOWING_MODE_UNDEFINED,
|
||||||
|
ACTIVITY_TYPE_STANDARD, null /* options */, adjacentRootTask /* sourceTask */,
|
||||||
|
0 /* launchFlags */, pinnedTask /* candidateTask */);
|
||||||
|
assertNull(actualRootTask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user