Fix Home key causes wrong animation

Wallpaper logic assumed that if mWallpaperTarget was non-null then
any wallpaper animation should be exiting. However, if the existing
wallpaper target was already animating away then mWallpaperTarget
remains non-null until it is completely gone. Pressing Home during
this time was causing the next animation to exit rather than reverse
and enter.

This fix looks to see if the wallpaper target is animating and if it
is to treat it as null for the purpose of determining which direction
the animation should go.

Fixes bug 6407941.

Change-Id: I731267328db0f9972a5aed6f214962f96737dd07
diff --git a/services/java/com/android/server/wm/WindowAnimator.java b/services/java/com/android/server/wm/WindowAnimator.java
index e5b1f2c..2e817ca 100644
--- a/services/java/com/android/server/wm/WindowAnimator.java
+++ b/services/java/com/android/server/wm/WindowAnimator.java
@@ -140,6 +140,8 @@
                     mService.debugLayoutRepeats("appToken " + appAnimator.mAppToken + " done",
                         mPendingLayoutChanges);
                 }
+                if (WindowManagerService.DEBUG_ANIM) Slog.v(TAG,
+                        "updateWindowsApps...: done animating " + appAnimator.mAppToken);
             }
         }
 
@@ -154,9 +156,11 @@
                 // stopped animating, do one more pass through the layout
                 mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
                 if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
-                    mService.debugLayoutRepeats("exiting appToken " + appAnimator.mAppToken 
+                    mService.debugLayoutRepeats("exiting appToken " + appAnimator.mAppToken
                         + " done", mPendingLayoutChanges);
                 }
+                if (WindowManagerService.DEBUG_ANIM) Slog.v(TAG,
+                        "updateWindowsApps...: done animating exiting " + appAnimator.mAppToken);
             }
         }
 
@@ -246,9 +250,9 @@
 
                 if (mPolicy.doesForceHide(win, win.mAttrs)) {
                     if (!wasAnimating && nowAnimating) {
-                        if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
-                                "Animation started that could impact force hide: "
-                                + win);
+                        if (WindowManagerService.DEBUG_ANIM ||
+                                WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
+                                "Animation started that could impact force hide: " + win);
                         mBulkUpdateParams |= SET_FORCE_HIDING_CHANGED;
                         mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
                         if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {