Moved rebuilding of display WindowList to DisplayContent

Some of this is also in WindowContainer and its children.
However, I hope we can remove the concept of window list in
the future.

Bug: 30060889
Change-Id: I9e531327643c28a0ba35baa812b9c2942993d7b7
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index e176c44..9d29a22 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -984,6 +984,11 @@
         }
     }
 
+    @Override
+    void onAppTransitionDone() {
+        sendingToBottom = false;
+    }
+
     /**
      * We override because this class doesn't want its children affecting its reported orientation
      * in anyway.
@@ -997,6 +1002,14 @@
     }
 
     @Override
+    int rebuildWindowList(DisplayContent dc, int addIndex) {
+        if (mIsExiting && !waitingForReplacement()) {
+            return addIndex;
+        }
+        return super.rebuildWindowList(dc, addIndex);
+    }
+
+    @Override
     AppWindowToken asAppWindowToken() {
         // I am an app window token!
         return this;