Prevent extraneous saving of pinned snap fraction.

- When the PIP is dismissed offscreen, the pinned stack can receive
  onConfigurationChanged (when its windowing mode is set back to
  fullscreen) after the stack is hidden.  In this case, the saved snap
  fraction will be incorrect leading to a wrong animation on the next
  PiP animation. We don't expect the snap fraction to be saved in this
  case since the user is not expanding the PiP.
- Also add the animating-bounds state to the proto for use in the cts
  tests.

Bug: 73775460
Test: atest CtsActivityManagerDeviceTestCases:ActivityManagerPinnedStackTests
Change-Id: I30398ecf11de045d11a95282b8203e4d2d344ae9
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 8fa94fb..e4e808e 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -1312,7 +1312,8 @@
         if (prevWinMode != WINDOWING_MODE_UNDEFINED && winMode == WINDOWING_MODE_PINNED) {
             // Entering PiP from fullscreen, reset the snap fraction
             mDisplayContent.mPinnedStackControllerLocked.resetReentrySnapFraction(this);
-        } else if (prevWinMode == WINDOWING_MODE_PINNED && winMode != WINDOWING_MODE_UNDEFINED) {
+        } else if (prevWinMode == WINDOWING_MODE_PINNED && winMode != WINDOWING_MODE_UNDEFINED
+                && !isHidden()) {
             // Leaving PiP to fullscreen, save the snap fraction based on the pre-animation bounds
             // for the next re-entry into PiP (assuming the activity is not hidden or destroyed)
             final TaskStack pinnedStack = mDisplayContent.getPinnedStack();