Merge "Cleanup logging code"
commit
a47a777476
|
@ -30,7 +30,6 @@ import android.graphics.Typeface;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -723,39 +722,15 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
x = (int)me.getX(index);
|
x = (int)me.getX(index);
|
||||||
y = (int)me.getY(index);
|
y = (int)me.getY(index);
|
||||||
}
|
}
|
||||||
if (ENABLE_USABILITY_STUDY_LOG) {
|
// TODO: This might be moved to the tracker.processMotionEvent() call below.
|
||||||
final String eventTag;
|
if (ENABLE_USABILITY_STUDY_LOG && action != MotionEvent.ACTION_MOVE) {
|
||||||
switch (action) {
|
writeUsabilityStudyLog(me, action, eventTime, index, id, x, y);
|
||||||
case MotionEvent.ACTION_UP:
|
|
||||||
eventTag = "[Up]";
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_DOWN:
|
|
||||||
eventTag = "[Down]";
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_POINTER_UP:
|
|
||||||
eventTag = "[PointerUp]";
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_POINTER_DOWN:
|
|
||||||
eventTag = "[PointerDown]";
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_MOVE: // Skip this as being logged below
|
|
||||||
eventTag = "";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
eventTag = "[Action" + action + "]";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!TextUtils.isEmpty(eventTag)) {
|
|
||||||
final float size = me.getSize(index);
|
|
||||||
final float pressure = me.getPressure(index);
|
|
||||||
UsabilityStudyLogUtils.getInstance().write(
|
|
||||||
eventTag + eventTime + "," + id + "," + x + "," + y + ","
|
|
||||||
+ size + "," + pressure);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// TODO: This should be moved to the tracker.processMotionEvent() call below.
|
||||||
|
// Currently the same "move" event is being logged twice.
|
||||||
if (ProductionFlag.IS_EXPERIMENTAL) {
|
if (ProductionFlag.IS_EXPERIMENTAL) {
|
||||||
ResearchLogger.mainKeyboardView_processMotionEvent(me, action, eventTime, index, id,
|
ResearchLogger.mainKeyboardView_processMotionEvent(
|
||||||
x, y);
|
me, action, eventTime, index, id, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mKeyTimerHandler.isInKeyRepeat()) {
|
if (mKeyTimerHandler.isInKeyRepeat()) {
|
||||||
|
@ -781,8 +756,9 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
final Key newKey = tracker.getKeyOn(x, y);
|
final Key newKey = tracker.getKeyOn(x, y);
|
||||||
if (mOldKey != newKey) {
|
if (mOldKey != newKey) {
|
||||||
tracker.onDownEvent(x, y, eventTime, this);
|
tracker.onDownEvent(x, y, eventTime, this);
|
||||||
if (action == MotionEvent.ACTION_UP)
|
if (action == MotionEvent.ACTION_UP) {
|
||||||
tracker.onUpEvent(x, y, eventTime);
|
tracker.onUpEvent(x, y, eventTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (pointerCount == 2 && oldPointerCount == 1) {
|
} else if (pointerCount == 2 && oldPointerCount == 1) {
|
||||||
// Single-touch to multi-touch transition.
|
// Single-touch to multi-touch transition.
|
||||||
|
@ -819,15 +795,11 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
}
|
}
|
||||||
tracker.onMoveEvent(px, py, eventTime, motionEvent);
|
tracker.onMoveEvent(px, py, eventTime, motionEvent);
|
||||||
if (ENABLE_USABILITY_STUDY_LOG) {
|
if (ENABLE_USABILITY_STUDY_LOG) {
|
||||||
final float pointerSize = me.getSize(i);
|
writeUsabilityStudyLog(me, action, eventTime, i, pointerId, px, py);
|
||||||
final float pointerPressure = me.getPressure(i);
|
|
||||||
UsabilityStudyLogUtils.getInstance().write("[Move]" + eventTime + ","
|
|
||||||
+ pointerId + "," + px + "," + py + ","
|
|
||||||
+ pointerSize + "," + pointerPressure);
|
|
||||||
}
|
}
|
||||||
if (ProductionFlag.IS_EXPERIMENTAL) {
|
if (ProductionFlag.IS_EXPERIMENTAL) {
|
||||||
ResearchLogger.mainKeyboardView_processMotionEvent(me, action, eventTime,
|
ResearchLogger.mainKeyboardView_processMotionEvent(
|
||||||
i, pointerId, px, py);
|
me, action, eventTime, i, pointerId, px, py);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -838,6 +810,35 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void writeUsabilityStudyLog(final MotionEvent me, final int action,
|
||||||
|
final long eventTime, final int index, final int id, final int x, final int y) {
|
||||||
|
final String eventTag;
|
||||||
|
switch (action) {
|
||||||
|
case MotionEvent.ACTION_UP:
|
||||||
|
eventTag = "[Up]";
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
eventTag = "[Down]";
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_POINTER_UP:
|
||||||
|
eventTag = "[PointerUp]";
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_POINTER_DOWN:
|
||||||
|
eventTag = "[PointerDown]";
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_MOVE:
|
||||||
|
eventTag = "[Move]";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
eventTag = "[Action" + action + "]";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
final float size = me.getSize(index);
|
||||||
|
final float pressure = me.getPressure(index);
|
||||||
|
UsabilityStudyLogUtils.getInstance().write(
|
||||||
|
eventTag + eventTime + "," + id + "," + x + "," + y + "," + size + "," + pressure);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closing() {
|
public void closing() {
|
||||||
super.closing();
|
super.closing();
|
||||||
|
|
Loading…
Reference in New Issue