Fix the starting window could not be removed.

When trying to remove the starting window from an activity and
there is another new transition applied, the starting window
could not be removed because
1. ActivityRecord#startingDisplayed were set to false.
2. Cannot apply TRANSIT_PREV_DONE animation in removeIfPossible
because firstWindowDrawn and startingDisplayed are both false.
3. Because the task is animating, so it thought the animation is
applied and we should wait for #onAnimationFinished.

There are two things to do for fix this issue
1. Only set startingDisplayed to false when the starting window
must not exist.
2. Check the animation is applied for the starting window instead
check isAnimating for whole task.

Fixes: 154189349
Test: atest AppWindowTokenTests
Change-Id: I9bda35c792aaa4d0865b370faca09f1a90035c29
3 files changed