From d5cd7e64aa30096241f63e47a9169699bdd98231 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Wed, 9 May 2012 15:45:35 +0900 Subject: [PATCH] Small optimization Change-Id: I067249976e557b60b606d2153deaeb3c8f1f38ac --- java/src/com/android/inputmethod/latin/LatinIME.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index b4be7e696..fc83167bb 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1478,9 +1478,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen sendKeyCodePoint(Keyboard.CODE_SPACE); } - if ((isAlphabet(primaryCode) + // NOTE: isCursorTouchingWord() is a blocking IPC call, so it often takes several + // dozen milliseconds. Avoid calling it as much as possible, since we are on the UI + // thread here. + if (!isComposingWord && (isAlphabet(primaryCode) || mSettingsValues.isSymbolExcludedFromWordSeparators(primaryCode)) - && isSuggestionsRequested() && !isComposingWord && !isCursorTouchingWord()) { + && isSuggestionsRequested() && !isCursorTouchingWord()) { // Reset entirely the composing state anyway, then start composing a new word unless // the character is a single quote. The idea here is, single quote is not a // separator and it should be treated as a normal character, except in the first