Consolidate TaskDisplayArea#addStack and TaskDisplayArea#addChild
When closing an app by swiping up, launcher runs a remote animation on the home task and the closing app task. If the most recent running task (via ATMS#getFilteredTasks) does not match the remote animation target task then the animation is not run and we see a flicker. When dismissing split screen, the recency of the primary split screen task is not updated. Fix this by eliminating two different code paths to add a child to TaskDisplayArea and ensure we update TaskDisplayArea#mPreferredTopFocusableStack. Test: swipe up to dismiss app after exiting split-screen Test: go/wm-smoke Fixes: 153583420 Change-Id: I592199d95f3f2ae56ad5ff638612cb63a3549602
This commit is contained in:
@@ -266,16 +266,14 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
|
||||
|
||||
@Override
|
||||
void addChild(ActivityStack stack, int position) {
|
||||
if (DEBUG_STACK) Slog.d(TAG_WM, "Set stack=" + stack + " on taskDisplayArea=" + this);
|
||||
addStackReferenceIfNeeded(stack);
|
||||
position = findPositionForStack(position, stack, true /* adding */);
|
||||
|
||||
super.addChild(stack, position);
|
||||
mAtmService.updateSleepIfNeededLocked();
|
||||
|
||||
// The reparenting case is handled in WindowContainer.
|
||||
if (!stack.mReparenting) {
|
||||
mDisplayContent.setLayoutNeeded();
|
||||
}
|
||||
positionStackAt(stack, position);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -637,12 +635,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) {
|
||||
if (ActivityTaskManagerDebugConfig.DEBUG_STACK) {
|
||||
Slog.v(TAG_STACK, "removeStack: detaching " + stack + " from displayId="
|
||||
@@ -786,7 +778,7 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
|
||||
}
|
||||
} else if (stack.getDisplayArea() != this || !stack.isRootTask()) {
|
||||
if (stack.getParent() == null) {
|
||||
addStack(stack, position);
|
||||
addChild(stack, position);
|
||||
} else {
|
||||
stack.reparent(this, onTop);
|
||||
}
|
||||
@@ -942,7 +934,7 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
|
||||
positionStackAtTop((ActivityStack) launchRootTask, false /* includingParents */);
|
||||
}
|
||||
} else {
|
||||
addStack(stack, onTop ? POSITION_TOP : POSITION_BOTTOM);
|
||||
addChild(stack, onTop ? POSITION_TOP : POSITION_BOTTOM);
|
||||
stack.setWindowingMode(windowingMode, true /* creating */);
|
||||
}
|
||||
return stack;
|
||||
|
||||
@@ -662,9 +662,11 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
||||
// position that takes into account the removed child (if the index of the
|
||||
// child < position, then the position should be adjusted). We should consider
|
||||
// doing this adjustment here and remove any adjustments in the callers.
|
||||
mChildren.remove(child);
|
||||
mChildren.add(position, child);
|
||||
onChildPositionChanged(child);
|
||||
if (mChildren.indexOf(child) != position) {
|
||||
mChildren.remove(child);
|
||||
mChildren.add(position, child);
|
||||
onChildPositionChanged(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1145,7 +1145,7 @@ public class ActivityStackTests extends ActivityTestsBase {
|
||||
mDefaultTaskDisplayArea.registerStackOrderChangedListener(listener);
|
||||
try {
|
||||
mStack.mReparenting = true;
|
||||
mDefaultTaskDisplayArea.addStack(mStack, 0);
|
||||
mDefaultTaskDisplayArea.addChild(mStack, 0);
|
||||
} finally {
|
||||
mDefaultTaskDisplayArea.unregisterStackOrderChangedListener(listener);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user