Merge "Move stack to front in-sync with task reparenting" into oc-dev

am: c4555784be

Change-Id: Ia9ea6523bb84c8ca4fbdd02da888a3ffef8dc543
This commit is contained in:
Wale Ogunwale
2017-04-14 17:41:52 +00:00
committed by android-build-merger
4 changed files with 10 additions and 9 deletions

View File

@@ -658,7 +658,8 @@ final class TaskRecord extends ConfigurationContainer implements TaskWindowConta
// Must reparent first in window manager to avoid a situation where AM can delete the
// we are coming from in WM before we reparent because it became empty.
mWindowContainerController.reparent(toStack.getWindowContainerController(), position);
mWindowContainerController.reparent(toStack.getWindowContainerController(), position,
moveStackMode == REPARENT_MOVE_STACK_TO_FRONT);
// Move the task
sourceStack.removeTask(this, reason, REMOVE_TASK_MODE_MOVING);

View File

@@ -184,7 +184,7 @@ class Task extends WindowContainer<AppWindowToken> implements DimLayer.DimLayerU
super.removeImmediately();
}
void reparent(TaskStack stack, int position) {
void reparent(TaskStack stack, int position, boolean moveParents) {
if (stack == mStack) {
throw new IllegalArgumentException(
"task=" + this + " already child of stack=" + mStack);
@@ -195,7 +195,7 @@ class Task extends WindowContainer<AppWindowToken> implements DimLayer.DimLayerU
final DisplayContent prevDisplayContent = getDisplayContent();
getParent().removeChild(this);
stack.addTask(this, position, showForAllUsers(), false /* moveParents */);
stack.addTask(this, position, showForAllUsers(), moveParents);
// Relayout display(s).
final DisplayContent displayContent = stack.getDisplayContent();

View File

@@ -121,7 +121,7 @@ public class TaskWindowContainerController
}
}
public void reparent(StackWindowController stackController, int position) {
public void reparent(StackWindowController stackController, int position, boolean moveParents) {
synchronized (mWindowMap) {
if (DEBUG_STACK) Slog.i(TAG_WM, "reparent: moving taskId=" + mTaskId
+ " to stack=" + stackController + " at " + position);
@@ -135,7 +135,7 @@ public class TaskWindowContainerController
throw new IllegalArgumentException("reparent: could not find stack="
+ stackController);
}
mContainer.reparent(stack, position);
mContainer.reparent(stack, position, moveParents);
mContainer.getDisplayContent().layoutAndAssignWindowLayersIfNeeded();
}
}

View File

@@ -89,7 +89,7 @@ public class TaskWindowContainerControllerTests extends WindowTestsBase {
boolean gotException = false;
try {
taskController.reparent(stackController1, 0);
taskController.reparent(stackController1, 0, false/* moveParents */);
} catch (IllegalArgumentException e) {
gotException = true;
}
@@ -100,14 +100,14 @@ public class TaskWindowContainerControllerTests extends WindowTestsBase {
stackController3.setContainer(null);
gotException = false;
try {
taskController.reparent(stackController3, 0);
taskController.reparent(stackController3, 0, false/* moveParents */);
} catch (IllegalArgumentException e) {
gotException = true;
}
assertTrue("Should not be able to reparent to a stack that doesn't have a container",
gotException);
taskController.reparent(stackController2, 0);
taskController.reparent(stackController2, 0, false/* moveParents */);
assertEquals(stackController2.mContainer, taskController.mContainer.getParent());
assertEquals(0, ((WindowTestUtils.TestTask) taskController.mContainer).positionInParent());
assertEquals(1, ((WindowTestUtils.TestTask) taskController2.mContainer).positionInParent());
@@ -135,7 +135,7 @@ public class TaskWindowContainerControllerTests extends WindowTestsBase {
(WindowTestUtils.TestTask) taskController2.mContainer;
// Reparent and check state
taskController.reparent(stack2Controller, 0);
taskController.reparent(stack2Controller, 0, false /* moveParents */);
assertEquals(stack2, task1.getParent());
assertEquals(0, task1.positionInParent());
assertEquals(1, task2.positionInParent());