aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorsatok <satok@google.com>2010-05-21 14:00:37 +0900
committersatok <satok@google.com>2010-05-21 15:01:37 +0900
commit107d9dd5c01e727eaae62195e94128722fc05afc (patch)
tree192aa32a9c7372274b88518a91e4e1d0a5f8285f /java/src
parented5d613e36d1a67b572c08c19147bded916e2f67 (diff)
downloadlatinime-107d9dd5c01e727eaae62195e94128722fc05afc.tar.gz
latinime-107d9dd5c01e727eaae62195e94128722fc05afc.tar.xz
latinime-107d9dd5c01e727eaae62195e94128722fc05afc.zip
Fix the valid length of a logged data
Change-Id: I94abccd9585edc42555ab3ffaed35f09cdfadd44
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinImeLogger.java25
1 files changed, 19 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinImeLogger.java b/java/src/com/android/inputmethod/latin/LatinImeLogger.java
index 54778b9ef..dcd1962c0 100644
--- a/java/src/com/android/inputmethod/latin/LatinImeLogger.java
+++ b/java/src/com/android/inputmethod/latin/LatinImeLogger.java
@@ -141,6 +141,9 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
}
private void addCountEntry(long time) {
+ if (sDBG) {
+ Log.d(TAG, "Log counts. (4)");
+ }
mLogBuffer.add(new LogEntry (time, ID_DELETE_COUNT,
new String[] {String.valueOf(mDeleteCount)}));
mLogBuffer.add(new LogEntry (time, ID_INPUT_COUNT,
@@ -153,14 +156,21 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
mInputCount = 0;
mWordCount = 0;
mActualCharCount = 0;
+ mLastTimeCountEntry = time;
}
private void addThemeIdEntry(long time) {
+ if (sDBG) {
+ Log.d(TAG, "Log theme Id. (1)");
+ }
mLogBuffer.add(new LogEntry (time, ID_THEME_ID,
new String[] {mThemeId}));
}
private void flushPrivacyLogSafely() {
+ if (sDBG) {
+ Log.d(TAG, "Log theme Id. (" + mPrivacyLogBuffer.size() + ")");
+ }
long now = System.currentTimeMillis();
Collections.sort(mPrivacyLogBuffer);
for (LogEntry l: mPrivacyLogBuffer) {
@@ -178,7 +188,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
private void addData(int tag, Object data) {
switch (tag) {
case ID_DELETE_COUNT:
- if (mLastTimeActive - mLastTimeCountEntry > MINIMUMCOUNTINTERVAL
+ if (((mLastTimeActive - mLastTimeCountEntry) > MINIMUMCOUNTINTERVAL)
|| (mDeleteCount == 0 && mInputCount == 0)) {
addCountEntry(mLastTimeActive);
addThemeIdEntry(mLastTimeActive);
@@ -186,7 +196,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
mDeleteCount += (Integer)data;
break;
case ID_INPUT_COUNT:
- if (mLastTimeActive - mLastTimeCountEntry > MINIMUMCOUNTINTERVAL
+ if (((mLastTimeActive - mLastTimeCountEntry) > MINIMUMCOUNTINTERVAL)
|| (mDeleteCount == 0 && mInputCount == 0)) {
addCountEntry(mLastTimeActive);
addThemeIdEntry(mLastTimeActive);
@@ -197,9 +207,9 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
case ID_AUTOSUGGESTION:
++mWordCount;
String[] dataStrings = (String[]) data;
- if (dataStrings.length != 3) {
+ if (dataStrings.length < 2) {
if (sDBG) {
- Log.e(TAG, "The length of string array is invalid.");
+ Log.e(TAG, "The length of logged string array is invalid.");
}
break;
}
@@ -216,9 +226,9 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
case ID_AUTOSUGGESTIONCANCELED:
--mWordCount;
dataStrings = (String[]) data;
- if (dataStrings.length != 3) {
+ if (dataStrings.length < 2) {
if (sDBG) {
- Log.e(TAG, "The length of string array is invalid.");
+ Log.e(TAG, "The length of logged string array is invalid.");
}
break;
}
@@ -241,6 +251,9 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
}
private void commitInternal() {
+ if (sDBG) {
+ Log.d(TAG, "Commit (" + mLogBuffer.size() + ")");
+ }
flushPrivacyLogSafely();
long now = System.currentTimeMillis();
addCountEntry(now);