From f1ce54891f54b4b75a7662fe08204e9d50e54e55 Mon Sep 17 00:00:00 2001 From: Kurt Partridge Date: Mon, 13 Aug 2012 10:30:12 -0700 Subject: [PATCH] [Rlog7] ResearchLog improve gesture tracking - count how many times a gesture is deleted - count num chars entered by gesture - change name of fns to reflect capturing gesture information when setting composing text Change-Id: I1b8ebf9cfcf304e0efd827c8b8e28a4010199728 --- .../com/android/inputmethod/latin/LatinIME.java | 3 +++ .../inputmethod/research/ResearchLogger.java | 17 ++++++++++++++--- .../inputmethod/research/Statistics.java | 13 ++++++++++++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index e455dfa32..cdb3ff945 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1637,6 +1637,9 @@ public final class LatinIME extends InputMethodService implements KeyboardAction if (length > 0) { if (mWordComposer.isBatchMode()) { mWordComposer.reset(); + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.latinIME_handleBackspace_batch(mWordComposer.getTypedWord()); + } } else { mWordComposer.deleteLast(); } diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java index a23b96ead..81c3fcac2 100644 --- a/java/src/com/android/inputmethod/research/ResearchLogger.java +++ b/java/src/com/android/inputmethod/research/ResearchLogger.java @@ -1208,7 +1208,15 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang final ResearchLogger researchLogger = getInstance(); researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_ONENDBATCHINPUT, enteredText, enteredWordPos); - researchLogger.mStatistics.recordGestureInput(); + researchLogger.mStatistics.recordGestureInput(enteredText.length()); + } + + private static final LogStatement LOGSTATEMENT_LATINIME_HANDLEBACKSPACE_BATCH = + new LogStatement("LatinIMEHandleBackspaceBatch", true, false, "deletedText"); + public static void latinIME_handleBackspace_batch(final CharSequence deletedText) { + final ResearchLogger researchLogger = getInstance(); + researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_HANDLEBACKSPACE_BATCH, deletedText); + researchLogger.mStatistics.recordGestureDelete(); } private static final LogStatement LOGSTATEMENT_STATISTICS = @@ -1216,7 +1224,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang "spaceCount", "deleteOpsCount", "wordCount", "isEmptyUponStarting", "isEmptinessStateKnown", "averageTimeBetweenKeys", "averageTimeBeforeDelete", "averageTimeDuringRepeatedDelete", "averageTimeAfterDelete", - "dictionaryWordCount", "splitWordsCount", "gestureInputCount"); + "dictionaryWordCount", "splitWordsCount", "gestureInputCount", + "gestureCharsCount", "gesturesDeletedCount"); private static void logStatistics() { final ResearchLogger researchLogger = getInstance(); final Statistics statistics = researchLogger.mStatistics; @@ -1228,6 +1237,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang statistics.mDuringRepeatedDeleteKeysCounter.getAverageTime(), statistics.mAfterDeleteKeyCounter.getAverageTime(), statistics.mDictionaryWordCount, statistics.mSplitWordsCount, - statistics.mGestureInputCount); + statistics.mGestureInputCount, + statistics.mGestureCharsCount, + statistics.mGesturesDeletedCount); } } diff --git a/java/src/com/android/inputmethod/research/Statistics.java b/java/src/com/android/inputmethod/research/Statistics.java index 23d1050cb..f9c072967 100644 --- a/java/src/com/android/inputmethod/research/Statistics.java +++ b/java/src/com/android/inputmethod/research/Statistics.java @@ -43,6 +43,10 @@ public class Statistics { int mSplitWordsCount; // Number of gestures that were input. int mGestureInputCount; + // Number of gestures that were deleted. + int mGesturesDeletedCount; + // Total number of characters in words entered by gesture. + int mGestureCharsCount; // Whether the text field was empty upon editing boolean mIsEmptyUponStarting; boolean mIsEmptinessStateKnown; @@ -109,6 +113,8 @@ public class Statistics { mBeforeDeleteKeyCounter.reset(); mDuringRepeatedDeleteKeysCounter.reset(); mAfterDeleteKeyCounter.reset(); + mGestureCharsCount = 0; + mGesturesDeletedCount = 0; mLastTapTime = 0; mIsLastKeyDeleteKey = false; @@ -161,12 +167,17 @@ public class Statistics { mSplitWordsCount++; } - public void recordGestureInput() { + public void recordGestureInput(final int numCharsEntered) { mGestureInputCount++; + mGestureCharsCount += numCharsEntered; } public void setIsEmptyUponStarting(final boolean isEmpty) { mIsEmptyUponStarting = isEmpty; mIsEmptinessStateKnown = true; } + + public void recordGestureDelete() { + mGesturesDeletedCount++; + } }