Check is leaf task before remove its child containers

This CL change the leaf check in removeIfPossilbe().

Previously, after removeImmediately() get called, all child
containers will be removed, then isLeafTask() will always return
true due to no more child for current entity.

Bug: 177858817
Bug: 206556390
Test: CTS
Change-Id: Id645fe58442662bb26c98cba488e8d9e684ab4bc
This commit is contained in:
Shengsong Tan
2022-06-07 03:54:21 +00:00
parent f2ec759eac
commit ed7fc7970f

View File

@@ -738,8 +738,9 @@ class Task extends TaskFragment {
"removeTask:" + reason + " deferring removing taskId=" + mTaskId);
return;
}
final boolean isLeafTask = isLeafTask();
removeImmediately(reason);
if (isLeafTask()) {
if (isLeafTask) {
mAtmService.getTaskChangeNotificationController().notifyTaskRemoved(mTaskId);
final TaskDisplayArea taskDisplayArea = getDisplayArea();