diff options
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java | 17 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java | 7 |
2 files changed, 17 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java index ad967c133..53abd2ecc 100644 --- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java @@ -27,6 +27,7 @@ import com.android.inputmethod.latin.makedict.UnsupportedFormatException; import com.android.inputmethod.latin.makedict.WordProperty; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion; +import com.android.inputmethod.latin.utils.AsyncResultHolder; import com.android.inputmethod.latin.utils.CombinedFormatUtils; import com.android.inputmethod.latin.utils.DistracterFilter; import com.android.inputmethod.latin.utils.ExecutorUtils; @@ -645,13 +646,15 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { public DictionaryStats getDictionaryStats() { reloadDictionaryIfRequired(); - mLock.readLock().lock(); - try { - // TODO: Get stats form the dictionary. - return new DictionaryStats(mLocale, mDictName, mDictFile); - } finally { - mLock.readLock().unlock(); - } + final AsyncResultHolder<DictionaryStats> result = new AsyncResultHolder<>(); + asyncExecuteTaskWithLock(mLock.readLock(), mDictName /* executorName */, new Runnable() { + @Override + public void run() { + // TODO: Get stats from the dictionary. + result.set(new DictionaryStats(mLocale, mDictName, mDictFile)); + } + }); + return result.get(null /* defaultValue */, TIMEOUT_FOR_READ_OPS_IN_MILLISECONDS); } @UsedForTesting diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index 0dabafb5e..46427e5ca 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -145,6 +145,13 @@ public final class InputLogic { */ public void startInput(final String combiningSpec, final SettingsValues settingsValues) { mEnteredText = null; + if (!mWordComposer.getTypedWord().isEmpty()) { + // For messaging apps that offer send button, the IME does not get the opportunity + // to capture the last word. This block should capture those uncommitted words. + // The timestamp at which it is captured is not accurate but close enough. + StatsUtils.onWordCommitUserTyped( + mWordComposer.getTypedWord(), mWordComposer.isBatchMode()); + } mWordComposer.restartCombining(combiningSpec); resetComposingState(true /* alsoResetLastComposedWord */); mDeleteCount = 0; |