Wait for leash in ImeInsetsSourceConsumer

Currently if we have an IME show request before the client has the
InsetsSourceControl, we mark this in mIsRequestedVisibleAwaitingControl
and re-try to show when we gain the control. However, if we gain a
control without a leash, we reset this awaiting control flag, but we
still cannot show. When we eventually get the control with the leash
later on, the awaiting control flag is reset, so we don't actually
re-try to show, when we should and could do so.

This takes into account both the availability of the control, and the
leash on the control, set in mIsRequestedVisibleAwaitingLeash.

These should fix any timing issues due to code changes such as [1].

  [1]: Ie7bb268f228ae8a8ed15e49b193aa2d0183f31ac

Bug: 328374719
Test: atest
  ImeInsetsSourceConsumerTest#testImeRequestedVisibleAwaitingControl
  ImeInsetsSourceConsumerTest#testImeRequestedVisibleAwaitingLeash
  WindowInsetsControllerTests#testShowImeOnCreate
  WindowInsetsControllerTests#testShowImeOnCreate_doesntCauseImeToReappearWhenDialogIsShown
Change-Id: I2fb3bf1dc057f85a9f8ad0166ec25519aa004905
2 files changed