diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java index b869059e4..da7d01af4 100644 --- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java @@ -54,6 +54,7 @@ import com.android.inputmethod.latin.StringUtils; import com.android.inputmethod.latin.SubtypeUtils; import com.android.inputmethod.latin.Utils; import com.android.inputmethod.latin.Utils.UsabilityStudyLogUtils; +import com.android.inputmethod.latin.Utils.UsabilityStudyLogUtils.LogGroup; import java.util.Locale; import java.util.WeakHashMap; @@ -701,7 +702,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke break; } if (!TextUtils.isEmpty(eventTag)) { - UsabilityStudyLogUtils.getInstance().write( + UsabilityStudyLogUtils.getInstance().write(LogGroup.MOTION_EVENT, eventTag + eventTime + "," + id + "," + x + "," + y + "," + me.getSize(index) + "," + me.getPressure(index)); } @@ -764,9 +765,10 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke } tracker.onMoveEvent(px, py, eventTime); if (ENABLE_USABILITY_STUDY_LOG) { - UsabilityStudyLogUtils.getInstance().write("[Move]" + eventTime + "," - + me.getPointerId(i) + "," + px + "," + py + "," - + me.getSize(i) + "," + me.getPressure(i)); + UsabilityStudyLogUtils.getInstance().write( + LogGroup.MOTION_EVENT, + "[Move]" + eventTime + "," + me.getPointerId(i) + "," + px + "," + py + + "," + me.getSize(i) + "," + me.getPressure(i)); } } } else { diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java index 509bd368d..36a3d3061 100644 --- a/java/src/com/android/inputmethod/latin/Utils.java +++ b/java/src/com/android/inputmethod/latin/Utils.java @@ -260,8 +260,25 @@ public class Utils { } } + /** + * Represents a category of logging events that share the same subfield structure. + */ + public static enum LogGroup { + MOTION_EVENT("m"), + KEY("k"), + CORRECTION("c"), + STATE_CHANGE("s"); + + private final String mLogString; + + private LogGroup(String logString) { + mLogString = logString; + } + } + public static void writeBackSpace(int x, int y) { - UsabilityStudyLogUtils.getInstance().write("\t" + x + "\t" + y); + UsabilityStudyLogUtils.getInstance().write( + LogGroup.KEY, "\t" + x + "\t" + y); } public void writeChar(char c, int x, int y) { @@ -277,11 +294,12 @@ public class Utils { inputChar = ""; break; } - UsabilityStudyLogUtils.getInstance().write(inputChar + "\t" + x + "\t" + y); + UsabilityStudyLogUtils.getInstance().write(LogGroup.KEY, + inputChar + "\t" + x + "\t" + y); LatinImeLogger.onPrintAllUsabilityStudyLogs(); } - public void write(final String log) { + public void write(final LogGroup logGroup, final String log) { mLoggingHandler.post(new Runnable() { @Override public void run() { @@ -289,8 +307,8 @@ public class Utils { final long currentTime = System.currentTimeMillis(); mDate.setTime(currentTime); - final String printString = String.format("%s\t%d\t%s\n", - mDateFormat.format(mDate), currentTime, log); + final String printString = String.format("%s\t%d\t%s\t%s\n", + mDateFormat.format(mDate), currentTime, logGroup.mLogString, log); if (LatinImeLogger.sDBG) { Log.d(USABILITY_TAG, "Write: " + log); }