Remove edge extension surface onAnimationLeashLost
This ensures that we don't run into any problems with race conditions and concurrent access to the transaction like we would if we were to clean up the the animation finished callback.
The problem was that we were removing the extensionSurfaces using the
mFrameTransaction in the animation finish callback which is which is
executed in the AnimationThread but mFrameTransaction is also used for
applying the animations frame by frame for all animations going through
the SurfaceAnimationRunner which run on the choreographer's looper
thread. This means we can get in a case where two different threads try
and access the mFrameTransaction which isn't supported (b/226317621).
To address this we make sure that the extension clean up, which removes
the edge extension surface, runs through the onAnimationLeashLost
callback so that it is applied on the same transaction and in the same
thread that the window being extended in the animation is reparented out
of the animation leash avoiding any concurrent access to the transaction.
Bug: 226553448
Test: atest CtsWindowManagerDeviceTestCases:AnimationEdgeExtensionTests
Change-Id: I7e65277a2ccf316f3b81d5a5aaebf0c892592aa9
2 files changed