Restrict DisplayContent creation.

This changelist limits DisplayContent the display
container/controller creation. All other callpoints now can only
retrieve existing DisplayContents. This removes the chances of
arbitrary calls generating a DisplayContent without the related
ActivityDisplay on the ActivityManager side.

Since display creation is now driven on the ActivityManager side,
the ActivityManagerService must be initialized and associated with
the WindowManagerService before the WindowManagerService can be fully
initialized. This is reflected in changes to SystemServer.

Fixes: 72228411
Test: go/wm-smoke-auto
Change-Id: I8dddb5fc109be4363de5ba87faff9d9885009042
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 5ea113b..75bb5e4 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -842,6 +842,14 @@
             ServiceManager.addService(Context.INPUT_SERVICE, inputManager);
             traceEnd();
 
+            traceBeginAndSlog("SetWindowManagerService");
+            mActivityManagerService.setWindowManager(wm);
+            traceEnd();
+
+            traceBeginAndSlog("WindowManagerServiceOnInitReady");
+            wm.onInitReady();
+            traceEnd();
+
             // Start receiving calls from HIDL services. Start in in a separate thread
             // because it need to connect to SensorManager. This have to start
             // after START_SENSOR_SERVICE is done.
@@ -859,10 +867,6 @@
                 traceEnd();
             }
 
-            traceBeginAndSlog("SetWindowManagerService");
-            mActivityManagerService.setWindowManager(wm);
-            traceEnd();
-
             traceBeginAndSlog("StartInputManager");
             inputManager.setWindowManagerCallbacks(wm.getInputMonitor());
             inputManager.start();