Skip IME show when target is changing.

There can be a race condition when IME is requested and IME target is
changing. If Ime target is closing, we will skip showing IME for it.

Fix: 144503054
Test: Manually:
        1. Open chrome, type in omnibox and swipe to home
	2. relaunch chrome and it will request IME
	3. swipe again to home
	4. repeat steps 2 and 3 quickly and verify
	   that IME doesn't hang on launcher

Change-Id: Iec9e44c5eb71eb4c6de693eb68c1887e7f883d1d
This commit is contained in:
Tarandeep Singh
2019-11-18 16:53:14 -08:00
committed by Taran Singh
parent 63f6cb7999
commit e30056acf9

View File

@@ -92,12 +92,13 @@ class ImeInsetsSourceProvider extends InsetsSourceProvider {
// Refer to WindowManagerService#applyImeVisibility(token, false).
// If IMMS's imeTarget is child of DisplayContent's imeTarget and child window
// is above the parent, we will consider it as the same target for now.
// Also, if imeTarget is closing, it would be considered as outdated target.
// TODO(b/139861270): Remove the child & sublayer check once IMMS is aware of
// actual IME target.
return mImeTargetFromIme == mDisplayContent.mInputMethodTarget
|| (mDisplayContent.mInputMethodTarget.getParentWindow() == mImeTargetFromIme
&& mDisplayContent.mInputMethodTarget.mSubLayer
> mImeTargetFromIme.mSubLayer);
final WindowState dcTarget = mDisplayContent.mInputMethodTarget;
return (!dcTarget.isClosing() && mImeTargetFromIme == dcTarget)
|| (dcTarget.getParentWindow() == mImeTargetFromIme
&& dcTarget.mSubLayer > mImeTargetFromIme.mSubLayer);
}
}