Fix app afterimage flashing while device unlocking
The problem is because in WMS#tryStartExitingAnimation set
win.mAnimatingExit as ture but not destroy surface when pressing
power button, so let `WindowState#mHasSurface` keeps true when
screen off. (Normally the surface should be destroyed when screen off)
This results when unlocking the screen will can see both the app
window afterimage and launcher are animating.
Check with DC#okToAnimate in tryStartExitingAnimation to ensure the
surface can be destroyed when the display is not ready to animate (e.g.
screen off).
Also, in order to cleanly clean up surfaces while cancelling recents
animation when the removal is allowed, make sure to invoke
onAnimationFinished for task's windows to finish the process of
the surface removal.
Fix: 173379232
Test: atest WmTests CtsWindowManagerDeviceTestCases
Test: atest RecentsAnimationControllerTests#\
testCleanupAnimation_expectExitAnimationDone
Test: manul as below steps:
1. in gesture nav mode, launch any apps (e.g. Settings).
2. swipe up app task to launcher
3. before swipe up animation finish, quickly pressing power button.
4. turn on screen and unlock, see if the app window flashing then back
to launcher.
Change-Id: Ib2778c1b2677752039be12a16a42623a25773fa2
3 files changed