Prevent reparenting to a fallback target while relaunching a pinned task
When relaunching a pinned task, excludes fallback launch target to source task so the corresponding task organizer can handle the relaunching properly. Fix: 231976162 Test: atest TaskDisplayAreaTests Test: repro steps in bug Change-Id: I1ce7339f5f987ef79a6feb5847941951cd6dcb06
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
|
||||
// same created-by-organizer task as well. Unless, the candidate task is already positioned
|
||||
// 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();
|
||||
if (launchTarget != null && launchTarget.getAdjacentTaskFragment() != null) {
|
||||
if (candidateTask != null) {
|
||||
|
||||
@@ -762,12 +762,20 @@ public class TaskDisplayAreaTests extends WindowTestsBase {
|
||||
Task actualRootTask = taskDisplayArea.getLaunchRootTask(WINDOWING_MODE_UNDEFINED,
|
||||
ACTIVITY_TYPE_STANDARD, null /* options */, adjacentRootTask /* sourceTask */,
|
||||
0 /* launchFlags */, candidateTask);
|
||||
assertSame(rootTask, actualRootTask.getRootTask());
|
||||
assertSame(rootTask, actualRootTask);
|
||||
|
||||
// Verify the launch root task without candidate task
|
||||
actualRootTask = taskDisplayArea.getLaunchRootTask(WINDOWING_MODE_UNDEFINED,
|
||||
ACTIVITY_TYPE_STANDARD, null /* options */, adjacentRootTask /* sourceTask */,
|
||||
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