Merge "Exclude the ActivityStack when processing the reset of a task"

This commit is contained in:
TreeHugger Robot
2020-02-13 02:36:04 +00:00
committed by Android (Google) Code Review
3 changed files with 18 additions and 11 deletions

View File

@@ -67,7 +67,7 @@ class ResetTargetTaskHelper {
final PooledConsumer c = PooledLambda.obtainConsumer(
ResetTargetTaskHelper::processTask, this, PooledLambda.__(Task.class));
targetTask.mWmService.mRoot.forAllTasks(c);
targetTask.mWmService.mRoot.forAllTasks(c, true /*traverseTopToBottom*/, mTargetStack);
c.recycle();
processPendingReparentActivities();

View File

@@ -3070,17 +3070,11 @@ class Task extends WindowContainer<WindowContainer> {
return matchParentBounds();
}
@Override
void forAllTasks(Consumer<Task> callback, boolean traverseTopToBottom, Task excludedTask) {
if (traverseTopToBottom) {
super.forAllTasks(callback, traverseTopToBottom);
if (excludedTask != this) {
callback.accept(this);
}
} else {
super.forAllTasks(callback, traverseTopToBottom);
if (excludedTask != this) {
callback.accept(this);
}
super.forAllTasks(callback, traverseTopToBottom, excludedTask);
if (excludedTask != this) {
callback.accept(this);
}
}

View File

@@ -1425,6 +1425,19 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
}
}
void forAllTasks(Consumer<Task> callback, boolean traverseTopToBottom, Task excludedTask) {
final int count = mChildren.size();
if (traverseTopToBottom) {
for (int i = count - 1; i >= 0; --i) {
mChildren.get(i).forAllTasks(callback, traverseTopToBottom, excludedTask);
}
} else {
for (int i = 0; i < count; i++) {
mChildren.get(i).forAllTasks(callback, traverseTopToBottom, excludedTask);
}
}
}
Task getTaskAbove(Task t) {
return getTask(
(above) -> true, t, false /*includeBoundary*/, false /*traverseTopToBottom*/);