Fix desktop immersive's state clean up

This change fixes two bugs related to state cleanup:
1) clearState() was called by #animateResizeChange when the animation
   finished even if the animation was not requested by a transition this
   handler is tracking (e.g. mixed transitions). To fix this, an end
   callback is sent to #animateResizeChange instead and only the
   DesktopImmersiveController#startAnimation call path clears the state
   when the callback is run.
2) Even when animating transitions handled by this handler, it is
   possible that its changes do not contain the expected immersive task,
   in which case there's nothing to animate, but the state should still
   be cleaned up.

Flag: com.android.window.flags.enable_fully_immersive_in_desktop
Fix: 376913079
Test: atest WMShellUnitTests
Change-Id: Ia7519bcb8e565b699d6b1cefd28869dc44da6413
2 files changed