Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Merge "Reset mServedView when failing to start input by not target wi…
Browse files Browse the repository at this point in the history
…ndow"
  • Loading branch information
Ming-Shin Lu authored and Android (Google) Code Review committed Dec 21, 2022
2 parents 52f9789 + 4d356f1 commit 41993ac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/java/android/view/inputmethod/InputMethodManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -2460,6 +2460,7 @@ private boolean startInputInner(@StartInputReason int startInputReason,
final EditorInfo editorInfo = connectionPair.second;
final Handler icHandler;
InputBindResult res = null;
final boolean hasServedView;
synchronized (mH) {
// Now that we are locked again, validate that our state hasn't
// changed.
Expand Down Expand Up @@ -2591,17 +2592,19 @@ && isSwitchingBetweenEquivalentNonEditableViews(
switch (res.result) {
case InputBindResult.ResultCode.ERROR_NOT_IME_TARGET_WINDOW:
mRestartOnNextWindowFocus = true;
mServedView = null;
break;
}
if (mCompletions != null) {
if (isImeSessionAvailableLocked()) {
mCurBindState.mImeSession.displayCompletions(mCompletions);
}
}
hasServedView = mServedView != null;
}

// Notify the app that the InputConnection is initialized and ready for use.
if (ic != null && res != null && res.method != null) {
if (ic != null && res != null && res.method != null && hasServedView) {
if (DEBUG) {
Log.v(TAG, "Calling View.onInputConnectionOpened: view= " + view
+ ", ic=" + ic + ", editorInfo=" + editorInfo + ", handler=" + icHandler);
Expand Down

0 comments on commit 41993ac

Please sign in to comment.