summaryrefslogtreecommitdiffstats
path: root/core/java/android/view/inputmethod
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2015-05-26 11:42:43 -0700
committerYohei Yukawa <yukawa@google.com>2015-05-26 11:42:43 -0700
commit41bb4953dad33b56b6d039d5bc87a574a0b70fe9 (patch)
tree13cb877d8b729991d5f485388ce4399e1e30869d /core/java/android/view/inputmethod
parent7891fcb52a8e0295e3f1d29f534376fd8cbc8d46 (diff)
downloadframeworks_base-41bb4953dad33b56b6d039d5bc87a574a0b70fe9.zip
frameworks_base-41bb4953dad33b56b6d039d5bc87a574a0b70fe9.tar.gz
frameworks_base-41bb4953dad33b56b6d039d5bc87a574a0b70fe9.tar.bz2
Rely on IMM#focusOut() to close input session.
Historically we have been doing nothing in IMM#focusOut(). Problem of ignoring IMM#focusOut() may not be obvious as long as IMM#focusIn() is called immediately after IMM#focusOut(). In some particular situations, however, IMM can fall into an inconsistent state where the software keyboard continues to be shown even when there is no text input field. As reported in b.android.com/171190 or Bug 20820914, we can easily reproduce that inconsistent state by removing a focused EditText from the parent view while the IME still keeps an active connection to the EditText. This CL tries to address such a situation by staring using IMM#focusOut() as another trigger to check IME focus. Note that this CL has no effect if IMM#focusOut was called after the current window losed the focus. It is supposed to be taken care of in subsequent CLs for Bug 20612313. This CL depends on Id6afc8fc64512225578c62557b96c7dc2e969adf. Bug: 20612313 Change-Id: Ib1b037594ebbb4ad4cf2d59e21c7a8ca9d8dc930
Diffstat (limited to 'core/java/android/view/inputmethod')
-rw-r--r--core/java/android/view/inputmethod/InputMethodManager.java16
1 files changed, 6 insertions, 10 deletions
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index f61e372..3f7bad6 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -1306,16 +1306,12 @@ public final class InputMethodManager {
if (DEBUG) Log.v(TAG, "focusOut: " + view
+ " mServedView=" + mServedView
+ " winFocus=" + view.hasWindowFocus());
- if (mServedView != view) {
- // The following code would auto-hide the IME if we end up
- // with no more views with focus. This can happen, however,
- // whenever we go into touch mode, so it ends up hiding
- // at times when we don't really want it to. For now it
- // seems better to just turn it all off.
- if (false && view.hasWindowFocus()) {
- mNextServedView = null;
- scheduleCheckFocusLocked(view);
- }
+ // CAVEAT: We have ignored focusOut event in Android L MR-1 and prior. Need special
+ // care when changing the logic here because there are so many cases to be taken into
+ // consideration, e.g., WindowManager.LayoutParams.SOFT_INPUT_* flags.
+ if (mServedView == view && view.hasWindowFocus()) {
+ mNextServedView = null;
+ scheduleCheckFocusLocked(view);
}
}
}