summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Justin Ho <justinho@google.com> 2012-02-16 09:27:16 -0800
committer Android Git Automerger <android-git-automerger@android.com> 2012-02-16 09:27:16 -0800
commit09170888cbc501cd9819b1caccc99592bc6dd73f (patch)
tree934cd8af7d2606cff09e719dfdb4890b68363c6c
parent22182aa3f7bc41c401bcb63fe6c86b735573cc07 (diff)
parentcc1bd4bbbc7314ab7d3ba015c16ea78cbfd6459f (diff)
am cc1bd4bb: am c470b2dd: Merge "Part of fixing issue #6006757: Keyboard dismissal lags" into ics-mr1
* commit 'cc1bd4bbbc7314ab7d3ba015c16ea78cbfd6459f': Part of fixing issue #6006757: Keyboard dismissal lags
-rw-r--r--core/java/android/view/inputmethod/InputMethodManager.java33
1 files changed, 22 insertions, 11 deletions
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index b41e6f5e7907..4e8542570615 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -355,8 +355,10 @@ public final class InputMethodManager {
if (mServedView != null && mServedView.isFocused()) {
mServedConnecting = true;
}
+ if (mActive) {
+ startInputInner();
+ }
}
- startInputInner();
}
return;
}
@@ -1127,20 +1129,26 @@ public final class InputMethodManager {
* @hide
*/
public void checkFocus() {
+ if (checkFocusNoStartInput()) {
+ startInputInner();
+ }
+ }
+
+ private boolean checkFocusNoStartInput() {
// This is called a lot, so short-circuit before locking.
if (mServedView == mNextServedView && !mNextServedNeedsStart) {
- return;
+ return false;
}
InputConnection ic = null;
synchronized (mH) {
if (mServedView == mNextServedView && !mNextServedNeedsStart) {
- return;
+ return false;
}
if (DEBUG) Log.v(TAG, "checkFocus: view=" + mServedView
+ " next=" + mNextServedView
+ " restart=" + mNextServedNeedsStart);
-
+
mNextServedNeedsStart = false;
if (mNextServedView == null) {
finishInputLocked();
@@ -1148,22 +1156,22 @@ public final class InputMethodManager {
// but no longer do. We should make sure the input method is
// no longer shown, since it serves no purpose.
closeCurrentInput();
- return;
+ return false;
}
-
+
ic = mServedInputConnection;
-
+
mServedView = mNextServedView;
mCurrentTextBoxAttribute = null;
mCompletions = null;
mServedConnecting = true;
}
-
+
if (ic != null) {
ic.finishComposingText();
}
-
- startInputInner();
+
+ return true;
}
void closeCurrentInput() {
@@ -1192,7 +1200,7 @@ public final class InputMethodManager {
focusInLocked(focusedView != null ? focusedView : rootView);
}
- checkFocus();
+ boolean startInput = checkFocusNoStartInput();
synchronized (mH) {
try {
@@ -1201,6 +1209,9 @@ public final class InputMethodManager {
mService.windowGainedFocus(mClient, rootView.getWindowToken(),
focusedView != null, isTextEditor, softInputMode, first,
windowFlags);
+ if (startInput) {
+ startInputInner();
+ }
} catch (RemoteException e) {
}
}