Fix a stale animator reference being used on bounds change

The call to setDestinationBounds applies the shadow if animation
type is alpha and it's called on each keep clear area change event,
when sometimes the enter PiP animation has not started yet (hence
there is a stale reference to old animator that should have been
cleaned up in onTaskVanished).

Bug: 275646078
Test: before http://recall/-/ekEuGtt9d9HWqkUtAzpHx8/dXniGevCFIEI5nyLN0zw1V
but only if the .isRuning condition is removed from updateAnimatorBounds
Test: after http://recall/-/ekEuGtt9d9HWqkUtAzpHx8/c3FwTxsPWiRT67JjxcWrMw

Change-Id: I34cb5b7621bf7c087d9c6e5a736b240e01d18a6a
This commit is contained in:
Mateusz Cicheński
2023-03-29 02:49:04 +00:00
parent 90a7bd1f9e
commit 79885f4c88
2 changed files with 6 additions and 0 deletions

View File

@@ -188,6 +188,11 @@ public class PipAnimationController {
return mCurrentAnimator;
}
/** Reset animator state to prevent it from being used after its lifetime. */
public void resetAnimatorState() {
mCurrentAnimator = null;
}
private PipTransitionAnimator setupPipTransitionAnimator(PipTransitionAnimator animator) {
animator.setSurfaceTransactionHelper(mSurfaceTransactionHelper);
animator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);

View File

@@ -1823,6 +1823,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
animator::clearContentOverlay);
}
PipAnimationController.quietCancel(animator);
mPipAnimationController.resetAnimatorState();
}
}