Separate out animations from layout.

(Dianne) pulled the animation steps out of the layout. Changes to
exposed layers cause repeated calls to layout code.

Combined animation steps into start and finish animation code.

Change-Id: I3602d1d6249d20987d102a54e3a67a7a39361b55
diff --git a/services/java/com/android/server/wm/AppWindowToken.java b/services/java/com/android/server/wm/AppWindowToken.java
index b84fbdb..5ca09e7 100644
--- a/services/java/com/android/server/wm/AppWindowToken.java
+++ b/services/java/com/android/server/wm/AppWindowToken.java
@@ -27,6 +27,7 @@
 import android.view.IApplicationToken;
 import android.view.View;
 import android.view.WindowManager;
+import android.view.WindowManagerPolicy;
 import android.view.animation.Animation;
 import android.view.animation.Transformation;
 
@@ -37,7 +38,7 @@
  * Version of WindowToken that is specifically for a particular application (or
  * really activity) that is displaying windows.
  */
-class AppWindowToken extends WindowToken implements WindowManagerService.StepAnimator {
+class AppWindowToken extends WindowToken {
     // Non-null only for application tokens.
     final IApplicationToken appToken;
 
@@ -195,8 +196,8 @@
         }
     }
 
-    @Override
-    public boolean stepAnimation(long currentTime) {
+
+    private boolean stepAnimation(long currentTime) {
         if (animation == null) {
             return false;
         }
@@ -216,7 +217,7 @@
     }
 
     // This must be called while inside a transaction.
-    boolean startAndFinishAnimationLocked(long currentTime, int dw, int dh) {
+    boolean stepAnimationLocked(long currentTime, int dw, int dh) {
         if (!service.mDisplayFrozen && service.mPolicy.isScreenOnFully()) {
             // We will run animations as long as the display isn't frozen.
 
@@ -240,7 +241,7 @@
                     animating = true;
                 }
                 // we're done!
-                return true;
+                return stepAnimation(currentTime);
             }
         } else if (animation != null) {
             // If the display is frozen, and there is a pending animation,
@@ -255,6 +256,7 @@
             return false;
         }
 
+        service.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
         clearAnimation();
         animating = false;
         if (animLayerAdjustment != 0) {