summaryrefslogtreecommitdiffstats
path: root/core/java/android/view
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-09-13 02:16:47 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-09-13 02:16:47 +0000
commit940a2ad69eaf25ef16b6f470f759f9eef28fc0c5 (patch)
treebe718e550901c19121ec6697d483b40fa3096282 /core/java/android/view
parent8c16943ef3259b8194c310d41edc13a783249250 (diff)
parentc743cb94770701ec20a01b57b09232f1aae5bcbb (diff)
downloadframeworks_base-940a2ad69eaf25ef16b6f470f759f9eef28fc0c5.zip
frameworks_base-940a2ad69eaf25ef16b6f470f759f9eef28fc0c5.tar.gz
frameworks_base-940a2ad69eaf25ef16b6f470f759f9eef28fc0c5.tar.bz2
Merge "Don't send the same values to onUpdateSelection repeatedly" into klp-dev
Diffstat (limited to 'core/java/android/view')
-rw-r--r--core/java/android/view/inputmethod/InputMethodManager.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index 54b87de..53f7c79 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -1412,12 +1412,17 @@ public final class InputMethodManager {
try {
if (DEBUG) Log.v(TAG, "SELECTION CHANGE: " + mCurMethod);
- mCurMethod.updateSelection(mCursorSelStart, mCursorSelEnd,
- selStart, selEnd, candidatesStart, candidatesEnd);
+ final int oldSelStart = mCursorSelStart;
+ final int oldSelEnd = mCursorSelEnd;
+ // Update internal values before sending updateSelection to the IME, because
+ // if it changes the text within its onUpdateSelection handler in a way that
+ // does not move the cursor we don't want to call it again with the same values.
mCursorSelStart = selStart;
mCursorSelEnd = selEnd;
mCursorCandStart = candidatesStart;
mCursorCandEnd = candidatesEnd;
+ mCurMethod.updateSelection(oldSelStart, oldSelEnd,
+ selStart, selEnd, candidatesStart, candidatesEnd);
} catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e);
}