From 6901ea6eacf719042e1af6f3d64c226e41c3c5e9 Mon Sep 17 00:00:00 2001 From: Mohammadinamul Sheik Date: Thu, 18 Sep 2014 17:55:04 -0700 Subject: [PATCH] Invoke onWordCommitUserTyped on startInput() with non empty wordcomposer In chat clients, the last committed word is not committed via rich input connection. This will handle those missed out cases. Change-Id: If3f1f6e1927cdf56a09d3e9124f05c66ca75de53 --- .../android/inputmethod/latin/inputlogic/InputLogic.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index 8eccd5cee..18c740bd7 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;