Merge "Reset IME show request when hide is requested"

This commit is contained in:
Taran Singh
2019-10-24 17:49:15 +00:00
committed by Android (Google) Code Review
2 changed files with 13 additions and 3 deletions

View File

@@ -56,8 +56,6 @@ class ImeInsetsSourceProvider extends InsetsSourceProvider {
if (mIsImeLayoutDrawn && mShowImeRunner != null) {
// Show IME if InputMethodService requested to be shown and it's layout has finished.
mShowImeRunner.run();
mIsImeLayoutDrawn = false;
mShowImeRunner = null;
}
}
@@ -74,10 +72,19 @@ class ImeInsetsSourceProvider extends InsetsSourceProvider {
mDisplayContent.mInputMethodTarget.showInsets(
WindowInsets.Type.ime(), true /* fromIme */);
}
mImeTargetFromIme = null;
abortShowImePostLayout();
};
}
/**
* Abort any pending request to show IME post layout.
*/
void abortShowImePostLayout() {
mImeTargetFromIme = null;
mIsImeLayoutDrawn = false;
mShowImeRunner = null;
}
private boolean isImeTargetFromDisplayContentAndImeSame() {
// IMMS#mLastImeTargetWindow always considers focused window as
// IME target, however DisplayContent#computeImeTarget() can compute

View File

@@ -7331,6 +7331,9 @@ public class WindowManagerService extends IWindowManager.Stub
synchronized (mGlobalLock) {
final DisplayContent dc = mRoot.getDisplayContent(displayId);
if (dc != null && dc.mInputMethodTarget != null) {
// If there was a pending IME show(), reset it as IME has been
// requested to be hidden.
dc.getInsetsStateController().getImeSourceProvider().abortShowImePostLayout();
dc.mInputMethodTarget.hideInsets(WindowInsets.Type.ime(), true /* fromIme */);
}
}