Clear out IME runnable if updating expanded state

When we update the stack expanded state, we first check for IME
visibility before performing the update.
If IME is visible, we try to hide IME first and then continue with
expand or collapse.
In case the IME callback does not trigger or takes too long, we can end
up in a state where the second call to expand/collapse runs before the
initial. Because the BubblePositioner state is updated immediately,
second time we immediately run the expand/collapse operation.
But if the IME callback finishes later, the runnable is still active in
BubbleController. And that runnable can run at a later stage.
This could cause for UI state to go out of sync with the state in
BubbleData. Where we think the bubble stack is collapsed, where it
actually was expanded.
Make sure the pending runnable is cleared out when a second call to
expand/collapse comes in and IME is already hidden.

Bug: 391909607
Flag: com.android.wm.shell.enable_bubble_swipe_up_cleanup
Test: atest WMShellMultivalentTestsOnDevice:com.android.wm.shell.bubbles.BubbleStackViewTest
Change-Id: I35a40cfedad74cf5be4ba3aef73df63ec0716e3b
4 files changed