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/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 30e1929..a917011 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -1935,7 +1935,7 @@
         if (mInputChannel != null) {
             throw new IllegalStateException("Window already has an input channel.");
         }
-        String name = makeInputChannelName();
+        String name = getName();
         InputChannel[] inputChannels = InputChannel.openInputChannelPair(name);
         mInputChannel = inputChannels[0];
         mClientChannel = inputChannels[1];
@@ -2843,6 +2843,8 @@
         region.op(mTmpRect, Region.Op.INTERSECT);
     }
 
+    // TODO: This is one reason why WindowList are bad...prime candidate for removal once we
+    // figure-out a good way to replace WindowList with WindowContainer hierarchy.
     WindowList getWindowList() {
         final DisplayContent displayContent = getDisplayContent();
         return displayContent == null ? null : displayContent.getWindowList();
@@ -3329,7 +3331,8 @@
         }
     }
 
-    String makeInputChannelName() {
+    @Override
+    String getName() {
         return Integer.toHexString(System.identityHashCode(this))
             + " " + getWindowTag();
     }
@@ -3743,6 +3746,16 @@
         return highestAnimLayer;
     }
 
+    @Override
+    int rebuildWindowList(DisplayContent dc, int addIndex) {
+        final DisplayContent winDisplayContent = getDisplayContent();
+        if (winDisplayContent == dc || winDisplayContent == null) {
+            mDisplayContent = dc;
+            return reAddWindow(addIndex);
+        }
+        return addIndex;
+    }
+
     // TODO: come-up with a better name for this method that represents what it does.
     // Or, it is probably not going to matter anyways if we are successful in getting rid of
     // the WindowList concept.