Fix index out of bounds of display removal

When removing a display, if it contains an activity in the active
transition, the display will be marked as removed and the activity
will be marked as exiting. Then when the animation is done, the
removal of the activity will continue while checking the deferred
removal from display. Once the activity is removed, because it is
the last activity and the display was marked as removed, all of its
parents will also be removed.

Bug: 143873959
Test: atest ActivityViewTest#testStartActivity
Change-Id: Iebee5b24fcb6b525c325d5aee2442b992ac6a35f
1 file changed