From 077d7af302e1419bd0cdc77aa7e4185fe24dc111 Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Tue, 16 May 2023 14:31:00 -0700 Subject: [PATCH] Avoid double end on PipTransitionAnimator From the stack trace, there is a call from DefaultMixedHandler to end the PipTransitionAnimator after the leash within PipAppIconOverlay has released. Fix this by ignoreing any end call once the animator's ended. Bug: 277662822 Test: Blind fix, no reproduce steps Change-Id: Ic910b75d9744afab7c24c385377b761e7a27ae59 --- .../src/com/android/wm/shell/pip/PipAnimationController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java index bbfeb90704db1..57cc28d1dde5c 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java @@ -328,6 +328,8 @@ public class PipAnimationController { private PipSurfaceTransactionHelper mSurfaceTransactionHelper; private @TransitionDirection int mTransitionDirection; protected PipContentOverlay mContentOverlay; + // Flag to avoid double-end + private boolean mHasRequestedEnd; private PipTransitionAnimator(TaskInfo taskInfo, SurfaceControl leash, @AnimationType int animationType, @@ -357,6 +359,7 @@ public class PipAnimationController { @Override public void onAnimationUpdate(ValueAnimator animation) { + if (mHasRequestedEnd) return; applySurfaceControlTransaction(mLeash, mSurfaceControlTransactionFactory.getTransaction(), animation.getAnimatedFraction()); @@ -364,6 +367,8 @@ public class PipAnimationController { @Override public void onAnimationEnd(Animator animation) { + if (mHasRequestedEnd) return; + mHasRequestedEnd = true; mCurrentValue = mEndValue; final SurfaceControl.Transaction tx = mSurfaceControlTransactionFactory.getTransaction();