Reset IME show request when hide is requested
If there was a pending IME show post layout, reset it when IME is
requested to be hidden.
Fix: 142705233
Test: Manually tested using Google keep:
1. Launch Google Keep and tap on search
2. New search activity will launch with IME shown
3. Press back on titlebar
4. Keep app requests IME again (bad behavior) and then
requests to hide it.
5. verified that show request is reset.
Change-Id: I79bebcbdb1a56e42b196e158f1d015ac64bf78cf
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 */);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user