Fix focus cleared and password keyboard shown during IME switching

When IME switches, InputMethodService will be rebound and re-initialize
input view, since it needs take time to update the layout, if the insets
calculation happens during the layout, the givenContentInsets are not ready
yet during this phases, then the insets size will abnormal
and may cause the IME target layout will be resized to zero height after
applied insets change.

If the view layout is focused, system will clear such 0-sized view
focus, since user can't easily aware and it's not safe to focus on invisible view
(refer CL[1]), then after IME switches, input connection will break because
the view focus lost.

Make sure to set the valid IME insets sources frame when the server side visible
set as true in InsetSourceProvider.

[1]: 5db64eb1da42118af65ceba1d0612fd82c294608

Fix: 153612876
Test: atest InsetsSourceProviderTest#testUpdateSourceFrameForIme
Test: atest InsetsSourceTest InsetsStateTest InsetsSourceProviderTest \
            InsetsControllerTest InsetsStateControllerTest \
            InsetsSourceConsumerTest
Test: atest ImeInsetsControllerTest

Change-Id: Id2c482e112c1d73cf7d5b3ba5e1a2d5775f47298
2 files changed