Clear sendingToBottom when animation is complete.

Was counting on moving the app to the top to clear the flag
indicating that the app was being sent to the bottom. Since this
did not always happen the sendingToBottom flag was occasionally
left set. In this case the focus was skipped for that app and
consequently input was never propagated to it.

This fix clears the sendingToBottom flag each time the app
animations are completed.

Fixes bug 6691421.

Change-Id: I6f851dc5bedca95182db8490d87c876a71ad5fde
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 5efbe2c..c329174 100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -8257,6 +8257,9 @@
 
         mAppTransitionRunning = false;
         // Restore window app tokens to the ActivityManager views
+        for (int i = mAnimatingAppTokens.size() - 1; i >= 0; i--) {
+            mAnimatingAppTokens.get(i).sendingToBottom = false;
+        }
         mAnimatingAppTokens.clear();
         mAnimatingAppTokens.addAll(mAppTokens);
         rebuildAppWindowListLocked();
@@ -9120,6 +9123,8 @@
 
             // If this window's application has been removed, just skip it.
             if (thisApp != null && (thisApp.removed || thisApp.sendingToBottom)) {
+                if (DEBUG_FOCUS) Slog.v(TAG, "Skipping app because " + (thisApp.removed
+                        ? "removed" : "sendingToBottom"));
                 continue;
             }