Optimize surface hierarchy

- Do not reset layer if layer doesn't change. JNI is expensive.
- Only assign child layers once if we have to do multiple passes.
- Fix issue where layouting the starting window caused the surface
to be resized, leading to a blocking SF transaction.

Test: go/wm-smoke
Test: adb logcat -b events | grep 319, inspect transition times.
Fixes: 69632880
Change-Id: I8fffca30591730fae87ed3aeb9df0bdf7d4b55dd
diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java
index 4008811..b08eb18 100644
--- a/services/core/java/com/android/server/wm/RootWindowContainer.java
+++ b/services/core/java/com/android/server/wm/RootWindowContainer.java
@@ -101,8 +101,6 @@
     private static final int SET_SCREEN_BRIGHTNESS_OVERRIDE = 1;
     private static final int SET_USER_ACTIVITY_TIMEOUT = 2;
 
-    WindowManagerService mService;
-
     private boolean mWallpaperForceHidingChanged = false;
     private Object mLastWindowFreezeSource = null;
     private Session mHoldScreen = null;
@@ -160,7 +158,7 @@
     };
 
     RootWindowContainer(WindowManagerService service) {
-        mService = service;
+        super(service);
         mHandler = new MyHandler(service.mH.getLooper());
         mWallpaperController = new WallpaperController(mService);
     }