Add additional structure to output logs to group entries by optional fields.
The new format has time, time as int, and the new logGroup code (m=motionEvent, k=key, s=statechange, c=correction) followed by additional text whose format depends on the logGroup code. The additional text will be cleaned up in later CL's. 20120321-170548.067+0900 1332317148067 m [Down]143116235,0,691,378,0.40000004,0.435 20120321-170548.133+0900 1332317148133 m [Up]143116302,0,691,378,0.40000004,0.435 20120321-170548.146+0900 1332317148146 k <enter> 691 378 20120321-170602.485+0900 1332317162485 s [onStartInputView]com.socialnmobile.dictapps.notepad.color.note,2131624043,147457,1140850694 20120321-170606.508+0900 1332317166508 m [Down]143134679,0,40,154,0.4666667,0.64 20120321-170606.567+0900 1332317166567 m [Move]143134723,0,42,154,0.4666667,0.765 20120321-170606.577+0900 1332317166577 m [Move]143134746,0,44,154,0.4666667,0.775 20120321-170606.652+0900 1332317166652 m [Up]143134824,0,44,154,0.4666667,0.775 20120321-170606.662+0900 1332317166662 k A 40 154 20120321-170607.200+0900 1332317167200 m [Down]143135372,0,411,390,0.53333336,0.585 20120321-170607.311+0900 1332317167311 m [Up]143135483,0,411,390,0.53333336,0.585 20120321-170607.313+0900 1332317167313 c [----]A Bug: 6188932 Change-Id: I8694eb9016d8cf0389ef582f6c7d2820aa4d2c92
This commit is contained in:
parent
2a7224a611
commit
78bf41b89c
2 changed files with 29 additions and 9 deletions
|
@ -54,6 +54,7 @@ import com.android.inputmethod.latin.StringUtils;
|
||||||
import com.android.inputmethod.latin.SubtypeUtils;
|
import com.android.inputmethod.latin.SubtypeUtils;
|
||||||
import com.android.inputmethod.latin.Utils;
|
import com.android.inputmethod.latin.Utils;
|
||||||
import com.android.inputmethod.latin.Utils.UsabilityStudyLogUtils;
|
import com.android.inputmethod.latin.Utils.UsabilityStudyLogUtils;
|
||||||
|
import com.android.inputmethod.latin.Utils.UsabilityStudyLogUtils.LogGroup;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
@ -701,7 +702,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(eventTag)) {
|
if (!TextUtils.isEmpty(eventTag)) {
|
||||||
UsabilityStudyLogUtils.getInstance().write(
|
UsabilityStudyLogUtils.getInstance().write(LogGroup.MOTION_EVENT,
|
||||||
eventTag + eventTime + "," + id + "," + x + "," + y + ","
|
eventTag + eventTime + "," + id + "," + x + "," + y + ","
|
||||||
+ me.getSize(index) + "," + me.getPressure(index));
|
+ me.getSize(index) + "," + me.getPressure(index));
|
||||||
}
|
}
|
||||||
|
@ -764,9 +765,10 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
||||||
}
|
}
|
||||||
tracker.onMoveEvent(px, py, eventTime);
|
tracker.onMoveEvent(px, py, eventTime);
|
||||||
if (ENABLE_USABILITY_STUDY_LOG) {
|
if (ENABLE_USABILITY_STUDY_LOG) {
|
||||||
UsabilityStudyLogUtils.getInstance().write("[Move]" + eventTime + ","
|
UsabilityStudyLogUtils.getInstance().write(
|
||||||
+ me.getPointerId(i) + "," + px + "," + py + ","
|
LogGroup.MOTION_EVENT,
|
||||||
+ me.getSize(i) + "," + me.getPressure(i));
|
"[Move]" + eventTime + "," + me.getPointerId(i) + "," + px + "," + py
|
||||||
|
+ "," + me.getSize(i) + "," + me.getPressure(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -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) {
|
public static void writeBackSpace(int x, int y) {
|
||||||
UsabilityStudyLogUtils.getInstance().write("<backspace>\t" + x + "\t" + y);
|
UsabilityStudyLogUtils.getInstance().write(
|
||||||
|
LogGroup.KEY, "<backspace>\t" + x + "\t" + y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeChar(char c, int x, int y) {
|
public void writeChar(char c, int x, int y) {
|
||||||
|
@ -277,11 +294,12 @@ public class Utils {
|
||||||
inputChar = "<space>";
|
inputChar = "<space>";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
UsabilityStudyLogUtils.getInstance().write(inputChar + "\t" + x + "\t" + y);
|
UsabilityStudyLogUtils.getInstance().write(LogGroup.KEY,
|
||||||
|
inputChar + "\t" + x + "\t" + y);
|
||||||
LatinImeLogger.onPrintAllUsabilityStudyLogs();
|
LatinImeLogger.onPrintAllUsabilityStudyLogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(final String log) {
|
public void write(final LogGroup logGroup, final String log) {
|
||||||
mLoggingHandler.post(new Runnable() {
|
mLoggingHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -289,8 +307,8 @@ public class Utils {
|
||||||
final long currentTime = System.currentTimeMillis();
|
final long currentTime = System.currentTimeMillis();
|
||||||
mDate.setTime(currentTime);
|
mDate.setTime(currentTime);
|
||||||
|
|
||||||
final String printString = String.format("%s\t%d\t%s\n",
|
final String printString = String.format("%s\t%d\t%s\t%s\n",
|
||||||
mDateFormat.format(mDate), currentTime, log);
|
mDateFormat.format(mDate), currentTime, logGroup.mLogString, log);
|
||||||
if (LatinImeLogger.sDBG) {
|
if (LatinImeLogger.sDBG) {
|
||||||
Log.d(USABILITY_TAG, "Write: " + log);
|
Log.d(USABILITY_TAG, "Write: " + log);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue