Fix recent task screenshot may not cleanup in some cases
In previous implementation, TaskScreenshotAnimatable's surface relies on SurfaceAnimator#onAnimationLeashDestroyed callback. As the definition of this callback method is called when leash is being destroyed, and the surface was reparented back to the original parent, which may not be reliable for recent task screenshot use case because task screenhot surface may fail to reparent back if the parent is null, and the onAnimationLeashDestroyed callback won't be called. To fix this, we modify the reparent check to exclude parent surface check. This is because the screenshot animatable was returning null in Animatable.getParentSurface(), but we still need to invoke onAnimationLeashDestroyed. We also rename the callback to onAnimationLeashLost as it will also be called when the animation is transferred away to another animation, even though the leash didn't get destroyed. Also, modified TaskScreenshotAnimatable#getParentSurfaceControl to align Task's surface for surface hierachy correctness. Fix: 130606600 Test: atest RecentsAnimationControllerTest Test: atest SurfaceAnimatorTest Change-Id: I918554befe3982a3dc0a9949c6973042697bb24b
Loading
Please register or sign in to comment