Fix the logics in ImeFocusController#onPostWindowFocus

In ImeFocusController#onPostWindowFocus -> onViewFocusChanged,
it implies that the view has focus after onPostWindowFocus, this logics
we keep leveraged from IMM#onPostWindowFocus -> focusInLocked() long
ago, which may not always be true as SearchView layout may call
View#clearFocus when size changed after IME switcher shown.

When IME switched and back to app activity, in the above call path,
even activity window focused, and set the fallback focus view as
activity's root view, but the root view is not actually focused,
if we set this view as the next served view, then calling
View#onCreateInputConnection will return null, because it's not an editor.

Use correct view focus state when calling onViewFocusChanged.

Fix: 153612876
Test: manual as below:
     1) Launch Files app, taps SearchView EditText
     2) switch IMEs with IME switcher dialog
     3) see if Password keyboard shown.
     4) keeps 2) and 3) several time.
     Expected: There is no password keyboard and
     the keyboard input is still workable.
Change-Id: I68bb95fc3cbfe1f5992ccf87694b34c3e52bb31f
1 file changed