Fix CTS test failure with hierarchical animation enabled.

Defer removal of ActivityRecord while its parent is animating.
With hierarchical animation enabled, some animations are applied on
ActivityStack instead of ActivityRecord. In this case, removal of
ActivityRecord must be deferred until the animation finishes, since
a surface having a frame buffer is tight with an ActivityRecord.

Cancel animation before moving Tasks from the pinned stack to
fullscreen stack.

Bug: 131661052
Test: atest ActivityLifecycleTopResumedStateTests
Change-Id: Iee5a31d06646ed681abdd6623a0d0a6a7763a4a9
3 files changed