diff options
author | 2013-01-10 11:22:22 -0800 | |
---|---|---|
committer | 2013-01-10 19:54:40 -0800 | |
commit | 05ee6ad84319de429ebdd6081f51a91ac2c5ae85 (patch) | |
tree | 7085e036c73ac19de925a3374240eaabb1698b57 /java/src/com/android/inputmethod/research/Statistics.java | |
parent | 75e69753b709c19d5a23baf88ec3ac2576ee9c24 (diff) | |
download | latinime-05ee6ad84319de429ebdd6081f51a91ac2c5ae85.tar.gz latinime-05ee6ad84319de429ebdd6081f51a91ac2c5ae85.tar.xz latinime-05ee6ad84319de429ebdd6081f51a91ac2c5ae85.zip |
[Rlog58b] Log user pauses
Change-Id: I7802f07192a4cba4f3cfb5c08ce6d5d2d85a46c1
Diffstat (limited to 'java/src/com/android/inputmethod/research/Statistics.java')
-rw-r--r-- | java/src/com/android/inputmethod/research/Statistics.java | 56 |
1 files changed, 36 insertions, 20 deletions
diff --git a/java/src/com/android/inputmethod/research/Statistics.java b/java/src/com/android/inputmethod/research/Statistics.java index e9c02c919..a9202651e 100644 --- a/java/src/com/android/inputmethod/research/Statistics.java +++ b/java/src/com/android/inputmethod/research/Statistics.java @@ -134,17 +134,9 @@ public class Statistics { if (DEBUG) { Log.d(TAG, "recordChar() called"); } - final long delta = time - mLastTapTime; if (codePoint == Constants.CODE_DELETE) { mDeleteKeyCount++; - if (delta < MIN_DELETION_INTERMISSION) { - if (mIsLastKeyDeleteKey) { - mDuringRepeatedDeleteKeysCounter.add(delta); - } else { - mBeforeDeleteKeyCounter.add(delta); - } - } - mIsLastKeyDeleteKey = true; + recordUserAction(time, true /* isDeletion */); } else { mCharCount++; if (Character.isDigit(codePoint)) { @@ -156,14 +148,8 @@ public class Statistics { if (Character.isSpaceChar(codePoint)) { mSpaceCount++; } - if (mIsLastKeyDeleteKey && delta < MIN_DELETION_INTERMISSION) { - mAfterDeleteKeyCounter.add(delta); - } else if (!mIsLastKeyDeleteKey && delta < MIN_TYPING_INTERMISSION) { - mKeyCounter.add(delta); - } - mIsLastKeyDeleteKey = false; + recordUserAction(time, false /* isDeletion */); } - mLastTapTime = time; } public void recordWordEntered(final boolean isDictionaryWord) { @@ -177,9 +163,10 @@ public class Statistics { mSplitWordsCount++; } - public void recordGestureInput(final int numCharsEntered) { + public void recordGestureInput(final int numCharsEntered, final long time) { mGesturesInputCount++; mGesturesCharsCount += numCharsEntered; + recordUserAction(time, false /* isDeletion */); } public void setIsEmptyUponStarting(final boolean isEmpty) { @@ -187,14 +174,43 @@ public class Statistics { mIsEmptinessStateKnown = true; } - public void recordGestureDelete() { + public void recordGestureDelete(final int length, final long time) { mGesturesDeletedCount++; + recordUserAction(time, true /* isDeletion */); } - public void recordManualSuggestion() { + + public void recordManualSuggestion(final long time) { mManualSuggestionsCount++; + recordUserAction(time, false /* isDeletion */); } - public void recordRevertCommit() { + public void recordRevertCommit(final long time) { mRevertCommitsCount++; + recordUserAction(time, true /* isDeletion */); + } + + private void recordUserAction(final long time, final boolean isDeletion) { + final long delta = time - mLastTapTime; + if (isDeletion) { + if (delta < MIN_DELETION_INTERMISSION) { + if (mIsLastKeyDeleteKey) { + mDuringRepeatedDeleteKeysCounter.add(delta); + } else { + mBeforeDeleteKeyCounter.add(delta); + } + } else { + ResearchLogger.onUserPause(delta); + } + } else { + if (mIsLastKeyDeleteKey && delta < MIN_DELETION_INTERMISSION) { + mAfterDeleteKeyCounter.add(delta); + } else if (!mIsLastKeyDeleteKey && delta < MIN_TYPING_INTERMISSION) { + mKeyCounter.add(delta); + } else { + ResearchLogger.onUserPause(delta); + } + } + mIsLastKeyDeleteKey = isDeletion; + mLastTapTime = time; } } |