From 226377e65aabe3922c47a4e40f7d846d346c55d5 Mon Sep 17 00:00:00 2001 From: Kurt Partridge Date: Sat, 22 Dec 2012 13:34:59 -0800 Subject: [PATCH] Log LatinIME.commitCurrentAutoCorrection() Change-Id: Ic46c91374ae0177cafad4579d28d6980af0d8d3a --- .../android/inputmethod/latin/LatinIME.java | 5 +++++ .../inputmethod/research/ResearchLogger.java | 22 ++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index cdb3ff945..8f77b08cc 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -2045,6 +2045,11 @@ public final class LatinIME extends InputMethodService implements KeyboardAction typedWord, autoCorrection.toString(), separatorString, mWordComposer); } mExpectingUpdateSelection = true; + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.latinIme_commitCurrentAutoCorrection(typedWord, + autoCorrection.toString(), separatorString); + } + commitChosenWord(autoCorrection, LastComposedWord.COMMIT_TYPE_DECIDED_WORD, separatorString); if (!typedWord.equals(autoCorrection)) { diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java index 316539a5b..b02278d1a 100644 --- a/java/src/com/android/inputmethod/research/ResearchLogger.java +++ b/java/src/com/android/inputmethod/research/ResearchLogger.java @@ -1224,6 +1224,26 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang completionInfo); } + /** + * Log a call to LatinIME.commitCurrentAutoCorrection(). + * + * SystemResponse: The IME has committed an auto-correction. An auto-correction changes the raw + * text input to another word that the user more likely desired to type. + */ + private static final LogStatement LOGSTATEMENT_LATINIME_COMMITCURRENTAUTOCORRECTION = + new LogStatement("LatinIMECommitCurrentAutoCorrection", true, false, "typedWord", + "autoCorrection", "separatorString"); + public static void latinIme_commitCurrentAutoCorrection(final String typedWord, + final String autoCorrection, final String separatorString) { + final String scrubbedTypedWord = scrubDigitsFromString(typedWord); + final String scrubbedAutoCorrection = scrubDigitsFromString(autoCorrection); + final ResearchLogger researchLogger = getInstance(); + researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_COMMITCURRENTAUTOCORRECTION, + scrubbedTypedWord, scrubbedAutoCorrection, separatorString); + researchLogger.onWordComplete(scrubbedAutoCorrection, Long.MAX_VALUE, + false /* isPartial */); + } + private boolean isExpectingCommitText = false; public static void latinIME_commitPartialText(final CharSequence committedWord, final long lastTimestampOfWordData) { @@ -1246,9 +1266,9 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang final ResearchLogger researchLogger = getInstance(); final String scrubbedWord = scrubDigitsFromString(committedWord.toString()); if (!researchLogger.isExpectingCommitText) { - researchLogger.onWordComplete(scrubbedWord, Long.MAX_VALUE, false /* isPartial */); researchLogger.enqueueEvent(LOGSTATEMENT_RICHINPUTCONNECTIONCOMMITTEXT, newCursorPosition); + researchLogger.onWordComplete(scrubbedWord, Long.MAX_VALUE, false /* isPartial */); } researchLogger.isExpectingCommitText = false; }