Switched TaskStack to use WindowContainer

Bug: 30060889
Test: Manual testing and existing tests still pass.
Change-Id: Id29c4aaf6580623a748bd69316fc6a4663ff1d37
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 04f592c..d707026 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -153,7 +153,7 @@
         if (content != null) {
             content.mDimLayerController.removeDimLayerUser(this);
         }
-        mStack.removeTask(this);
+        mParent.removeChild(this);
         mService.mTaskIdToTask.delete(mTaskId);
     }
 
@@ -165,9 +165,7 @@
         if (DEBUG_STACK) Slog.i(TAG, "moveTaskToStack: removing taskId=" + mTaskId
                 + " from stack=" + mStack);
         EventLog.writeEvent(EventLogTags.WM_TASK_REMOVED, mTaskId, "moveTask");
-        if (mStack != null) {
-            mStack.removeTask(this);
-        }
+        mParent.removeChild(this);
         stack.addTask(this, toTop);
     }
 
@@ -176,7 +174,7 @@
             if (DEBUG_STACK) Slog.i(TAG, "positionTaskInStack: removing taskId=" + mTaskId
                     + " from stack=" + mStack);
             EventLog.writeEvent(EventLogTags.WM_TASK_REMOVED, mTaskId, "moveTask");
-            mStack.removeTask(this);
+            mStack.removeChild(this);
         }
         stack.positionTask(this, position, showForAllUsers());
         resizeLocked(bounds, config, false /* force */);
@@ -186,6 +184,7 @@
         }
     }
 
+    @Override
     void removeChild(AppWindowToken token) {
         if (!mChildren.contains(token)) {
             Slog.e(TAG, "removeChild: token=" + this + " not found.");