Prevent ANR when app is terminated abruptly

When app is forced stop, the removeImeSurface flow
from DisplayImeController will be dropped in IMMS
and IMS because some fields (IMMS#mShowRequested,
IMS#mShowInputRequested..etc) still remain previous
state. The launcher cannot receive keyevent at that
time since IME surface remain and cause ANR.

Calling hideCurrentInputLocked() to hide the IME
surface when a IME client is removed.

Bug: 167780081
Test: atest CtsInputMethodTestCases
Test: Verify with issue reproduce steps:
      1) Add another language to the keyboard
      2) Open chrome and tap the EditText to show keyboard
      3) Tap to show language swiching dialog
      4) adb shell am force-stop com.android.chrome
      5) adb shell input keyevent 8
      6) Verify there is no ANR happen
Change-Id: Ifb91111f7136952462678ff6d0a5e917abb5005e
2 files changed