Exclude the ActivityStack when processing the reset of a task
When processing the reset of task by ResetTargetTaskHelper, we should
prevent to process task with ActivityStack case. This CL exclude the
root task(ActivityStack) when execute the processing the reset of a task.
Bug: 148590003
Test: atest WmTests:ActivityStackTests
atest WmTests:TaskTests
atest WmTests:ActivityRecordTests
Change-Id: I63ed4c2d87f7844fc05c6f61434a0923f2ed3d21
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -3064,17 +3064,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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*/);
|
||||
|
||||
Reference in New Issue
Block a user