Ime target window should control when to hide IME (1/2)

Input method frameworks uses focused window and some tricks
to best guestimate IME target. Though it doesn't always know the
actual IME target. e.g. when window has both NOT_FOCUSABLE,
ALT_FOCUSABLE_IM; IMF thinks focued window is IME target but it isn't
the case.

The right thing to do is to call both show(IME), hide(IME) on IME
target.

Bug: 142461756
Bug: 111084606
Test: Manually tested using steps below:
  1. Make sure new insets flag is enabled
  2. Launch any activity which has child window with NOT_FOCUSABLE,
     ALT_FOCUSABLE_IM (e.g. Instagram login screen)
  3. Verify IME can be shown and hidden by this window.

Change-Id: I13f3e04f6f9e1574db9cbb56bdb7817152499d03
6 files changed