Prevent task from exiting immersive twice on close

When a task is closing, the full immersive handler restores its bounds
and appends the transition to its list of tracked transitions. It also
add a change to prevent direct enter/exit while a pending transition is
in progress, to prevent the case where a onTaskInfoChanged changing the
immersive state of the app re-triggers an enter/exit while another
enter/exit is already in progress.
Finally, it adjusts the close animation to always animate from the start
bounds, since the taskInfo/end bounds can now be different even on close
transitions.

Flag: com.android.window.flags.enable_fully_immersive_in_desktop
Bug: 373987723
Test: enter desktop immersive, close the task using the header icon,
verify no crash and it animates correctly

Change-Id: I068b925ca45bd68d98434e1105bf0a3716247202
10 files changed