Set initial position for WindowAnimation and reparent animation leash.

1. Set the initial position for the WindowAnimationSpec to be the stack
position.
2. Reparent the animation leash to mAnimationLayer
3. Updated Surface names for clarity.

Test: Opening apps animate from the correct start location. When apps
are animating, their layers are reparented to the correct animation
layer.

Change-Id: I3e3a1e45f0a0cf9d471dee105abd9bce05d1e91d
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 8d7f432..d053015 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -136,7 +136,6 @@
 import android.util.MutableBoolean;
 import android.util.Slog;
 import android.util.proto.ProtoOutputStream;
-import android.view.animation.Transformation;
 import android.view.Display;
 import android.view.DisplayInfo;
 import android.view.InputDevice;
@@ -3176,7 +3175,7 @@
         /**
          * A control placed at the appropriate level for transitions to occur.
          */
-        SurfaceControl mAnimationLayer = null;
+        SurfaceControl mAppAnimationLayer = null;
 
         // Cached reference to some special stacks we tend to get a lot so we don't need to loop
         // through the list to find them.
@@ -3522,19 +3521,28 @@
             // The appropriate place for App-Transitions to occur is right
             // above all other animations but still below things in the Picture-and-Picture
             // windowing mode.
-            if (mAnimationLayer != null) {
-                t.setLayer(mAnimationLayer, layer++);
+            if (mAppAnimationLayer != null) {
+                t.setLayer(mAppAnimationLayer, layer++);
             }
         }
 
         @Override
+        SurfaceControl getAppAnimationLayer() {
+            return mAppAnimationLayer;
+        }
+
+        @Override
         void onParentSet() {
             super.onParentSet();
             if (getParent() != null) {
-                mAnimationLayer = makeSurface().build();
+                mAppAnimationLayer = makeChildSurface(null)
+                        .setName("animationLayer")
+                        .build();
+                getPendingTransaction().show(mAppAnimationLayer);
+                scheduleAnimation();
             } else {
-                mAnimationLayer.destroy();
-                mAnimationLayer = null;
+                mAppAnimationLayer.destroy();
+                mAppAnimationLayer = null;
             }
         }
     }