Merge "Various debugging enhancements."
diff --git a/services/java/com/android/server/wm/AppWindowAnimator.java b/services/java/com/android/server/wm/AppWindowAnimator.java
index 2ed900e..6964137 100644
--- a/services/java/com/android/server/wm/AppWindowAnimator.java
+++ b/services/java/com/android/server/wm/AppWindowAnimator.java
@@ -15,6 +15,7 @@
  *
  */
 public class AppWindowAnimator {
+    static final String TAG = "AppWindowAnimator";
 
     final AppWindowToken mAppToken;
     final WindowManagerService mService;
@@ -43,6 +44,8 @@
     Animation thumbnailAnimation;
     final Transformation thumbnailTransformation = new Transformation();
 
+    static final Animation sDummyAnimation = new DummyAnimation();
+
     public AppWindowAnimator(final WindowManagerService service, final AppWindowToken atoken) {
         mService = service;
         mAppToken = atoken;
@@ -51,7 +54,7 @@
 
     public void setAnimation(Animation anim, boolean initialized) {
         if (WindowManagerService.localLOGV) Slog.v(
-            WindowManagerService.TAG, "Setting animation in " + this + ": " + anim);
+            TAG, "Setting animation in " + this + ": " + anim);
         animation = anim;
         animating = false;
         animInitialized = initialized;
@@ -78,8 +81,8 @@
     public void setDummyAnimation() {
         if (animation == null) {
             if (WindowManagerService.localLOGV) Slog.v(
-                WindowManagerService.TAG, "Setting dummy animation in " + this);
-            animation = WindowManagerService.sDummyAnimation;
+                TAG, "Setting dummy animation in " + this);
+            animation = sDummyAnimation;
             animInitialized = false;
         }
     }
@@ -111,7 +114,7 @@
             if (winAnimator.mAnimLayer > thumbnailLayer) {
                 thumbnailLayer = winAnimator.mAnimLayer;
             }
-            if (WindowManagerService.DEBUG_LAYERS) Slog.v(WindowManagerService.TAG, "Updating layer " + w + ": "
+            if (WindowManagerService.DEBUG_LAYERS) Slog.v(TAG, "Updating layer " + w + ": "
                     + winAnimator.mAnimLayer);
             if (w == mService.mInputMethodTarget && !mService.mInputMethodTargetWaitingAnim) {
                 mService.setInputMethodAnimLayerAdjustment(adj);
@@ -162,14 +165,12 @@
         transformation.clear();
         final boolean more = animation.getTransformation(currentTime, transformation);
         if (WindowManagerService.DEBUG_ANIM) Slog.v(
-            WindowManagerService.TAG, "Stepped animation in " + this +
-            ": more=" + more + ", xform=" + transformation);
+            TAG, "Stepped animation in " + this + ": more=" + more + ", xform=" + transformation);
         if (!more) {
             animation = null;
             clearThumbnail();
             if (WindowManagerService.DEBUG_ANIM) Slog.v(
-                WindowManagerService.TAG, "Finished animation in " + this +
-                " @ " + currentTime);
+                TAG, "Finished animation in " + this + " @ " + currentTime);
         }
         hasTransformation = more;
         return more;
@@ -180,7 +181,7 @@
         if (mService.okToDisplay()) {
             // We will run animations as long as the display isn't frozen.
 
-            if (animation == WindowManagerService.sDummyAnimation) {
+            if (animation == sDummyAnimation) {
                 // This guy is going to animate, but not yet.  For now count
                 // it as not animating for purposes of scheduling transactions;
                 // when it is really time to animate, this will be set to
@@ -194,7 +195,7 @@
                     && animation != null) {
                 if (!animating) {
                     if (WindowManagerService.DEBUG_ANIM) Slog.v(
-                        WindowManagerService.TAG, "Starting animation in " + this +
+                        TAG, "Starting animation in " + this +
                         " @ " + currentTime + ": dw=" + dw + " dh=" + dh
                         + " scale=" + mService.mTransitionAnimationScale
                         + " allDrawn=" + mAppToken.allDrawn + " animating=" + animating);
@@ -247,7 +248,7 @@
         }
 
         if (WindowManagerService.DEBUG_ANIM) Slog.v(
-                WindowManagerService.TAG, "Animation done in " + this
+                TAG, "Animation done in " + this
                 + ": reportedVisible=" + mAppToken.reportedVisible);
 
         transformation.clear();
@@ -266,7 +267,7 @@
         final int NW = mAppToken.allAppWindows.size();
         for (int i=0; i<NW; i++) {
             WindowStateAnimator winAnimator = mAppToken.allAppWindows.get(i).mWinAnimator;
-            if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG,
+            if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
                     "performing show on: " + winAnimator);
             winAnimator.performShowLocked();
             isAnimating |= winAnimator.isAnimating();
@@ -300,4 +301,15 @@
                     pw.println(thumbnailTransformation.toShortString());
         }
     }
+
+    // This is an animation that does nothing: it just immediately finishes
+    // itself every time it is called.  It is used as a stub animation in cases
+    // where we want to synchronize multiple things that may be animating.
+    static final class DummyAnimation extends Animation {
+        @Override
+        public boolean getTransformation(long currentTime, Transformation outTransformation) {
+            return false;
+        }
+    }
+
 }
diff --git a/services/java/com/android/server/wm/WindowAnimator.java b/services/java/com/android/server/wm/WindowAnimator.java
index 8333ab5..f1ad539 100644
--- a/services/java/com/android/server/wm/WindowAnimator.java
+++ b/services/java/com/android/server/wm/WindowAnimator.java
@@ -130,7 +130,7 @@
         for (i=0; i<NAT; i++) {
             final AppWindowAnimator appAnimator = mService.mAppTokens.get(i).mAppAnimator;
             final boolean wasAnimating = appAnimator.animation != null
-                    && appAnimator.animation != WindowManagerService.sDummyAnimation;
+                    && appAnimator.animation != AppWindowAnimator.sDummyAnimation;
             if (appAnimator.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
                 mAnimating = true;
             } else if (wasAnimating) {
@@ -147,7 +147,7 @@
         for (i=0; i<NEAT; i++) {
             final AppWindowAnimator appAnimator = mService.mExitingAppTokens.get(i).mAppAnimator;
             final boolean wasAnimating = appAnimator.animation != null
-                    && appAnimator.animation != WindowManagerService.sDummyAnimation;
+                    && appAnimator.animation != AppWindowAnimator.sDummyAnimation;
             if (appAnimator.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
                 mAnimating = true;
             } else if (wasAnimating) {
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index ff41899d..1f7b297 100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -4111,7 +4111,7 @@
             boolean runningAppAnimation = false;
 
             if (transit != WindowManagerPolicy.TRANSIT_UNSET) {
-                if (wtoken.mAppAnimator.animation == sDummyAnimation) {
+                if (wtoken.mAppAnimator.animation == AppWindowAnimator.sDummyAnimation) {
                     wtoken.mAppAnimator.animation = null;
                 }
                 if (applyAnimationLocked(wtoken, lp, transit, visible)) {
@@ -6580,16 +6580,6 @@
         }
     }
 
-    // This is an animation that does nothing: it just immediately finishes
-    // itself every time it is called.  It is used as a stub animation in cases
-    // where we want to synchronize multiple things that may be animating.
-    static final class DummyAnimation extends Animation {
-        public boolean getTransformation(long currentTime, Transformation outTransformation) {
-            return false;
-        }
-    }
-    static final Animation sDummyAnimation = new DummyAnimation();
-
     // -------------------------------------------------------------
     // Async Handler
     // -------------------------------------------------------------
diff --git a/services/java/com/android/server/wm/WindowStateAnimator.java b/services/java/com/android/server/wm/WindowStateAnimator.java
index 74e3304..9147a10 100644
--- a/services/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/java/com/android/server/wm/WindowStateAnimator.java
@@ -390,10 +390,10 @@
 
     // This must be called while inside a transaction.
     boolean commitFinishDrawingLocked(long currentTime) {
-        //Slog.i(TAG, "commitFinishDrawingLocked: " + mSurface);
         if (mDrawState != COMMIT_DRAW_PENDING) {
             return false;
         }
+        //Slog.i(TAG, "commitFinishDrawingLocked: Draw pending. " + mSurface);
         mDrawState = READY_TO_SHOW;
         final boolean starting = mWin.mAttrs.type == TYPE_APPLICATION_STARTING;
         final AppWindowToken atoken = mWin.mAppToken;
@@ -515,7 +515,8 @@
 
         @Override
         public String toString() {
-            return "Surface " + mName + ": shown=" + mShown + " layer=" + mLayer
+            return "Surface " + Integer.toHexString(System.identityHashCode(this)) + " "
+                    + mName + ": shown=" + mShown + " layer=" + mLayer
                     + " alpha=" + mSurfaceTraceAlpha + " " + mPosition.x + "," + mPosition.y
                     + " " + mSize.x + "x" + mSize.y;
         }