Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e30056ac authored by Tarandeep Singh's avatar Tarandeep Singh Committed by Taran Singh
Browse files

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
parent 63f6cb79
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -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);
    }

}