Merge "Merge "5GE Icon: Show 5G subscript E (italics)" into qt-r1-dev am: 7a1f8da2fb am: 20c5204d25 am: 88847f01c9"
diff --git a/services/core/java/com/android/server/wm/InsetsSourceProvider.java b/services/core/java/com/android/server/wm/InsetsSourceProvider.java
index 402ec59..b7835aa 100644
--- a/services/core/java/com/android/server/wm/InsetsSourceProvider.java
+++ b/services/core/java/com/android/server/wm/InsetsSourceProvider.java
@@ -106,6 +106,11 @@
             @Nullable TriConsumer<DisplayFrames, WindowState, Rect> frameProvider) {
         if (mWin != null) {
             mWin.setInsetProvider(null);
+            // The window may be animating such that we can hand out the leash to the control
+            // target. Revoke the leash by cancelling the animation to correct the state.
+            // TODO: Ideally, we should wait for the animation to finish so previous window can
+            // animate-out as new one animates-in.
+            mWin.cancelAnimation();
         }
         mWin = win;
         mFrameProvider = frameProvider;