Do not detach children of starting windows

In case we need to relaunch an activity, we detach it's children
just about at the same time when we add the splash screen.
However, detaching will have the side effect that all transactions
will be ignored so the starting window will never become visible,
leading to an ugly hole.

I don't think there is any good reason to detach the children of
the starting window

This is a regression from the task snapshot scaling change, so
it's important to fix.

Test: Open app, go home, toggle battery saver, reopen app
Fixes: 137284423
Change-Id: Id2f4e5e4225c1c693b1fbcb5b0d7cf4b17f9a6e7
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index 2c0a733..3505afb 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -1493,6 +1493,12 @@
     }
 
     void detachChildren() {
+
+        // Do not detach children of starting windows, as their lifecycle is well under control and
+        // it may lead to issues in case we relaunch when we just added the starting window.
+        if (mWin.mAttrs.type == TYPE_APPLICATION_STARTING) {
+            return;
+        }
         if (mSurfaceController != null) {
             mSurfaceController.detachChildren();
         }