Loading services/core/java/com/android/server/wm/TaskDisplayArea.java +4 −12 Original line number Original line Diff line number Diff line Loading @@ -267,16 +267,14 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> { @Override @Override void addChild(ActivityStack stack, int position) { void addChild(ActivityStack stack, int position) { if (DEBUG_STACK) Slog.d(TAG_WM, "Set stack=" + stack + " on taskDisplayArea=" + this); addStackReferenceIfNeeded(stack); addStackReferenceIfNeeded(stack); position = findPositionForStack(position, stack, true /* adding */); position = findPositionForStack(position, stack, true /* adding */); super.addChild(stack, position); super.addChild(stack, position); mAtmService.updateSleepIfNeededLocked(); mAtmService.updateSleepIfNeededLocked(); // The reparenting case is handled in WindowContainer. positionStackAt(stack, position); if (!stack.mReparenting) { mDisplayContent.setLayoutNeeded(); } } } @Override @Override Loading Loading @@ -638,12 +636,6 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> { } } } } void addStack(ActivityStack stack, int position) { if (DEBUG_STACK) Slog.d(TAG_WM, "Set stack=" + stack + " on taskDisplayArea=" + this); addChild(stack, position); positionStackAt(stack, position); } void onStackRemoved(ActivityStack stack) { void onStackRemoved(ActivityStack stack) { if (ActivityTaskManagerDebugConfig.DEBUG_STACK) { if (ActivityTaskManagerDebugConfig.DEBUG_STACK) { Slog.v(TAG_STACK, "removeStack: detaching " + stack + " from displayId=" Slog.v(TAG_STACK, "removeStack: detaching " + stack + " from displayId=" Loading Loading @@ -787,7 +779,7 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> { } } } else if (stack.getDisplayArea() != this || !stack.isRootTask()) { } else if (stack.getDisplayArea() != this || !stack.isRootTask()) { if (stack.getParent() == null) { if (stack.getParent() == null) { addStack(stack, position); addChild(stack, position); } else { } else { stack.reparent(this, onTop); stack.reparent(this, onTop); } } Loading Loading @@ -943,7 +935,7 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> { positionStackAtTop((ActivityStack) launchRootTask, false /* includingParents */); positionStackAtTop((ActivityStack) launchRootTask, false /* includingParents */); } } } else { } else { addStack(stack, onTop ? POSITION_TOP : POSITION_BOTTOM); addChild(stack, onTop ? POSITION_TOP : POSITION_BOTTOM); stack.setWindowingMode(windowingMode, true /* creating */); stack.setWindowingMode(windowingMode, true /* creating */); } } return stack; return stack; Loading services/core/java/com/android/server/wm/WindowContainer.java +5 −3 Original line number Original line Diff line number Diff line Loading @@ -662,11 +662,13 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< // position that takes into account the removed child (if the index of the // position that takes into account the removed child (if the index of the // child < position, then the position should be adjusted). We should consider // child < position, then the position should be adjusted). We should consider // doing this adjustment here and remove any adjustments in the callers. // doing this adjustment here and remove any adjustments in the callers. if (mChildren.indexOf(child) != position) { mChildren.remove(child); mChildren.remove(child); mChildren.add(position, child); mChildren.add(position, child); onChildPositionChanged(child); onChildPositionChanged(child); } } } } } /** /** * Notify that a child's position has changed. Possible changes are adding or removing a child. * Notify that a child's position has changed. Possible changes are adding or removing a child. Loading services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1196,7 +1196,7 @@ public class ActivityStackTests extends ActivityTestsBase { mDefaultTaskDisplayArea.registerStackOrderChangedListener(listener); mDefaultTaskDisplayArea.registerStackOrderChangedListener(listener); try { try { mStack.mReparenting = true; mStack.mReparenting = true; mDefaultTaskDisplayArea.addStack(mStack, 0); mDefaultTaskDisplayArea.addChild(mStack, 0); } finally { } finally { mDefaultTaskDisplayArea.unregisterStackOrderChangedListener(listener); mDefaultTaskDisplayArea.unregisterStackOrderChangedListener(listener); } } Loading Loading
services/core/java/com/android/server/wm/TaskDisplayArea.java +4 −12 Original line number Original line Diff line number Diff line Loading @@ -267,16 +267,14 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> { @Override @Override void addChild(ActivityStack stack, int position) { void addChild(ActivityStack stack, int position) { if (DEBUG_STACK) Slog.d(TAG_WM, "Set stack=" + stack + " on taskDisplayArea=" + this); addStackReferenceIfNeeded(stack); addStackReferenceIfNeeded(stack); position = findPositionForStack(position, stack, true /* adding */); position = findPositionForStack(position, stack, true /* adding */); super.addChild(stack, position); super.addChild(stack, position); mAtmService.updateSleepIfNeededLocked(); mAtmService.updateSleepIfNeededLocked(); // The reparenting case is handled in WindowContainer. positionStackAt(stack, position); if (!stack.mReparenting) { mDisplayContent.setLayoutNeeded(); } } } @Override @Override Loading Loading @@ -638,12 +636,6 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> { } } } } void addStack(ActivityStack stack, int position) { if (DEBUG_STACK) Slog.d(TAG_WM, "Set stack=" + stack + " on taskDisplayArea=" + this); addChild(stack, position); positionStackAt(stack, position); } void onStackRemoved(ActivityStack stack) { void onStackRemoved(ActivityStack stack) { if (ActivityTaskManagerDebugConfig.DEBUG_STACK) { if (ActivityTaskManagerDebugConfig.DEBUG_STACK) { Slog.v(TAG_STACK, "removeStack: detaching " + stack + " from displayId=" Slog.v(TAG_STACK, "removeStack: detaching " + stack + " from displayId=" Loading Loading @@ -787,7 +779,7 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> { } } } else if (stack.getDisplayArea() != this || !stack.isRootTask()) { } else if (stack.getDisplayArea() != this || !stack.isRootTask()) { if (stack.getParent() == null) { if (stack.getParent() == null) { addStack(stack, position); addChild(stack, position); } else { } else { stack.reparent(this, onTop); stack.reparent(this, onTop); } } Loading Loading @@ -943,7 +935,7 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> { positionStackAtTop((ActivityStack) launchRootTask, false /* includingParents */); positionStackAtTop((ActivityStack) launchRootTask, false /* includingParents */); } } } else { } else { addStack(stack, onTop ? POSITION_TOP : POSITION_BOTTOM); addChild(stack, onTop ? POSITION_TOP : POSITION_BOTTOM); stack.setWindowingMode(windowingMode, true /* creating */); stack.setWindowingMode(windowingMode, true /* creating */); } } return stack; return stack; Loading
services/core/java/com/android/server/wm/WindowContainer.java +5 −3 Original line number Original line Diff line number Diff line Loading @@ -662,11 +662,13 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< // position that takes into account the removed child (if the index of the // position that takes into account the removed child (if the index of the // child < position, then the position should be adjusted). We should consider // child < position, then the position should be adjusted). We should consider // doing this adjustment here and remove any adjustments in the callers. // doing this adjustment here and remove any adjustments in the callers. if (mChildren.indexOf(child) != position) { mChildren.remove(child); mChildren.remove(child); mChildren.add(position, child); mChildren.add(position, child); onChildPositionChanged(child); onChildPositionChanged(child); } } } } } /** /** * Notify that a child's position has changed. Possible changes are adding or removing a child. * Notify that a child's position has changed. Possible changes are adding or removing a child. Loading
services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1196,7 +1196,7 @@ public class ActivityStackTests extends ActivityTestsBase { mDefaultTaskDisplayArea.registerStackOrderChangedListener(listener); mDefaultTaskDisplayArea.registerStackOrderChangedListener(listener); try { try { mStack.mReparenting = true; mStack.mReparenting = true; mDefaultTaskDisplayArea.addStack(mStack, 0); mDefaultTaskDisplayArea.addChild(mStack, 0); } finally { } finally { mDefaultTaskDisplayArea.unregisterStackOrderChangedListener(listener); mDefaultTaskDisplayArea.unregisterStackOrderChangedListener(listener); } } Loading