Merge "Avoid double end on PipTransitionAnimator" into udc-dev am: 839aca67df

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23270226

Change-Id: I36dab5f0c369e4b149c8910495ef04f7df3456d2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Hongwei Wang
2023-05-17 23:17:20 +00:00
committed by Automerger Merge Worker

View File

@@ -328,6 +328,8 @@ public class PipAnimationController {
private PipSurfaceTransactionHelper mSurfaceTransactionHelper; private PipSurfaceTransactionHelper mSurfaceTransactionHelper;
private @TransitionDirection int mTransitionDirection; private @TransitionDirection int mTransitionDirection;
protected PipContentOverlay mContentOverlay; protected PipContentOverlay mContentOverlay;
// Flag to avoid double-end
private boolean mHasRequestedEnd;
private PipTransitionAnimator(TaskInfo taskInfo, SurfaceControl leash, private PipTransitionAnimator(TaskInfo taskInfo, SurfaceControl leash,
@AnimationType int animationType, @AnimationType int animationType,
@@ -357,6 +359,7 @@ public class PipAnimationController {
@Override @Override
public void onAnimationUpdate(ValueAnimator animation) { public void onAnimationUpdate(ValueAnimator animation) {
if (mHasRequestedEnd) return;
applySurfaceControlTransaction(mLeash, applySurfaceControlTransaction(mLeash,
mSurfaceControlTransactionFactory.getTransaction(), mSurfaceControlTransactionFactory.getTransaction(),
animation.getAnimatedFraction()); animation.getAnimatedFraction());
@@ -364,6 +367,8 @@ public class PipAnimationController {
@Override @Override
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
if (mHasRequestedEnd) return;
mHasRequestedEnd = true;
mCurrentValue = mEndValue; mCurrentValue = mEndValue;
final SurfaceControl.Transaction tx = final SurfaceControl.Transaction tx =
mSurfaceControlTransactionFactory.getTransaction(); mSurfaceControlTransactionFactory.getTransaction();