Workaround for input ANR, always finish PiP menu activity.

- Always finish the PiP menu activity when the interaction is complete
  (either the menu is hidden after showing, or when the user stops
  interacting with it and it was shown for the dismiss overlay)
- Fix issue with bounds animation callback not working due to the app
  window being removed and not updating the app transition that its
  animation "finished"
- Add additional logging throughout to trace PiP animation

Bug: 36877782
Test: Enter PIP, tap to show menu, wait for it to hide, and then use
      wired headset button

Change-Id: Ie88ba107d7fffdd182a4063ef4f324b58669d0ad
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 1decf4e..a8664a5 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -505,6 +505,13 @@
             getController().removeStartingWindow();
         }
 
+        // If this window was animating, then we need to ensure that the app transition notifies
+        // that animations have completed in WMS.handleAnimatingStoppedAndTransitionLocked(), so
+        // add to that list now
+        if (mAppAnimator.animating) {
+            mService.mNoAnimationNotifyOnTransitionFinished.add(token);
+        }
+
         final TaskStack stack = getTask().mStack;
         if (delayed && !isEmpty()) {
             // set the token aside because it has an active animation to be finished