Skip to content

Commit 3573950

Browse files
committed
Close the current input method when attached view doesn't have a handler
Bug: 7187452 Change-Id: Iba4f7ac89f5806e871aaeb97f366935b83b95a5a
1 parent d27f1cd commit 3573950

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

core/java/android/view/inputmethod/InputMethodManager.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,8 +1078,11 @@ boolean startInputInner(IBinder windowGainingFocus, int controlFlags, int softIn
10781078
Handler vh = view.getHandler();
10791079
if (vh == null) {
10801080
// If the view doesn't have a handler, something has changed out
1081-
// from under us, so just bail.
1082-
if (DEBUG) Log.v(TAG, "ABORT input: no handler for view!");
1081+
// from under us, so just close the current input.
1082+
// If we don't close the current input, the current input method can remain on the
1083+
// screen without a connection.
1084+
if (DEBUG) Log.v(TAG, "ABORT input: no handler for view! Close current input.");
1085+
closeCurrentInput();
10831086
return false;
10841087
}
10851088
if (vh.getLooper() != Looper.myLooper()) {

services/java/com/android/server/InputMethodManagerService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1843,7 +1843,7 @@ public InputBindResult windowGainedFocus(IInputMethodClient client, IBinder wind
18431843

18441844
if (mCurFocusedWindow == windowToken) {
18451845
Slog.w(TAG, "Window already focused, ignoring focus gain of: " + client
1846-
+ " attribute=" + attribute);
1846+
+ " attribute=" + attribute + ", token = " + windowToken);
18471847
if (attribute != null) {
18481848
return startInputUncheckedLocked(cs, inputContext, attribute,
18491849
controlFlags);

0 commit comments

Comments
 (0)