Fix IME flickering when swiping out to home

When switching tasks between different users (i.e. primary and
work-profile user), if the source task has shown IME, when going to
the target task, IMMS will first unbind the current input method of
the current user and hide the soft-keyboard and the window token
by HIDE_SWITCH_USER reason, and then re-bind the input method of
the target user when focused to the target task.

If the hide soft-keyboard somehow being delayed and comes after the
target task has been focused and be the next IME target, user will
see the window removal transition on top of this IME target window.
(i.e. launching Google chat apps with IME shown from work-profile
 and then swiping out to home screen)

Even if we disable window animation in Activity#onDestory in IME
client side, the next relayout can come before that, so window exit
transition still happens.

To fix this timing issue, add animateExit parameter in
WindowManagerInternal#removeToken for IMMS not to perform window exit
animation and to hide the window surface permanentaly, so we can
avoid the window surface becoming visible again unexpectedly during

Fix: 197494607
Fix: 195449326
Test: atest WindowTokenTests#\
Test: manual as issue steps:
1. Enter Google chat
2. Start typing a message
3. Swipe home
4. Expect no IME surface flicker happens

Merged-In: I044257b5ac0d92dd06dae8eba996ea0ac6f1e659
Change-Id: I044257b5ac0d92dd06dae8eba996ea0ac6f1e659
(cherry picked from commit 0b44f104b3893877960f7a9a41927911469ae563)
8 files changed