Notify task about display change when moved to new stack
Bug: 34176283
Test: android.server.cts.ActivityManagerDisplayTests
Test: #testMoveTaskBetweenDisplays
Test: bit FrameworksServicesTests:com.android.server.wm.TaskWindowContainerControllerTests
Test: bit FrameworksServicesTests:com.android.server.wm.TaskStackContainersTests
Change-Id: If085246926790089e014a94093d788805e812489
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 2d50e3a..4928fc9 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -186,8 +186,18 @@
if (DEBUG_STACK) Slog.i(TAG, "reParentTask: removing taskId=" + mTaskId
+ " from stack=" + mStack);
EventLog.writeEvent(WM_TASK_REMOVED, mTaskId, "reParentTask");
+ final DisplayContent prevDisplayContent = getDisplayContent();
+
getParent().removeChild(this);
stack.addTask(this, position, showForAllUsers(), false /* moveParents */);
+
+ // Relayout display(s).
+ final DisplayContent displayContent = stack.getDisplayContent();
+ displayContent.setLayoutNeeded();
+ if (prevDisplayContent != displayContent) {
+ onDisplayChanged(displayContent);
+ prevDisplayContent.setLayoutNeeded();
+ }
}
/** @see com.android.server.am.ActivityManagerService#positionTaskInStack(int, int, int). */