Add UsabilityStudyLogUtils.writeMotionEvent
Change-Id: I41ee6d1879dc937e1554fedfc603d9bb5bec40f2main
parent
acb3cc7473
commit
30977a151e
|
@ -117,9 +117,6 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
PointerTracker.DrawingProxy, MoreKeysPanel.Controller {
|
PointerTracker.DrawingProxy, MoreKeysPanel.Controller {
|
||||||
private static final String TAG = MainKeyboardView.class.getSimpleName();
|
private static final String TAG = MainKeyboardView.class.getSimpleName();
|
||||||
|
|
||||||
// TODO: Kill process when the usability study mode was changed.
|
|
||||||
private static final boolean ENABLE_USABILITY_STUDY_LOG = LatinImeLogger.sUsabilityStudy;
|
|
||||||
|
|
||||||
/** Listener for {@link KeyboardActionListener}. */
|
/** Listener for {@link KeyboardActionListener}. */
|
||||||
private KeyboardActionListener mKeyboardActionListener;
|
private KeyboardActionListener mKeyboardActionListener;
|
||||||
|
|
||||||
|
@ -1069,8 +1066,8 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
final int y = (int)me.getY(index);
|
final int y = (int)me.getY(index);
|
||||||
|
|
||||||
// TODO: This might be moved to the tracker.processMotionEvent() call below.
|
// TODO: This might be moved to the tracker.processMotionEvent() call below.
|
||||||
if (ENABLE_USABILITY_STUDY_LOG && action != MotionEvent.ACTION_MOVE) {
|
if (LatinImeLogger.sUsabilityStudy) {
|
||||||
writeUsabilityStudyLog(me, action, eventTime, index, id, x, y);
|
UsabilityStudyLogUtils.writeMotionEvent(me);
|
||||||
}
|
}
|
||||||
// TODO: This should be moved to the tracker.processMotionEvent() call below.
|
// TODO: This should be moved to the tracker.processMotionEvent() call below.
|
||||||
// Currently the same "move" event is being logged twice.
|
// Currently the same "move" event is being logged twice.
|
||||||
|
@ -1131,15 +1128,6 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
final int px = (int)me.getX(i);
|
final int px = (int)me.getX(i);
|
||||||
final int py = (int)me.getY(i);
|
final int py = (int)me.getY(i);
|
||||||
tracker.onMoveEvent(px, py, eventTime, me);
|
tracker.onMoveEvent(px, py, eventTime, me);
|
||||||
if (ENABLE_USABILITY_STUDY_LOG) {
|
|
||||||
writeUsabilityStudyLog(me, action, eventTime, i, pointerId, px, py);
|
|
||||||
}
|
|
||||||
// TODO: This seems to be no longer necessary, and confusing because it leads to
|
|
||||||
// duplicate MotionEvents being recorded.
|
|
||||||
// if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
|
|
||||||
// ResearchLogger.mainKeyboardView_processMotionEvent(
|
|
||||||
// me, action, eventTime, i, pointerId, px, py);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final PointerTracker tracker = PointerTracker.getPointerTracker(id, this);
|
final PointerTracker tracker = PointerTracker.getPointerTracker(id, this);
|
||||||
|
@ -1149,35 +1137,6 @@ 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void cancelAllOngoingEvents() {
|
public void cancelAllOngoingEvents() {
|
||||||
mKeyTimerHandler.cancelAllMessages();
|
mKeyTimerHandler.cancelAllMessages();
|
||||||
mDrawingHandler.cancelAllMessages();
|
mDrawingHandler.cancelAllMessages();
|
||||||
|
|
|
@ -25,6 +25,7 @@ import android.os.Handler;
|
||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
|
||||||
import com.android.inputmethod.latin.LatinImeLogger;
|
import com.android.inputmethod.latin.LatinImeLogger;
|
||||||
|
|
||||||
|
@ -109,6 +110,43 @@ public final class UsabilityStudyLogUtils {
|
||||||
LatinImeLogger.onPrintAllUsabilityStudyLogs();
|
LatinImeLogger.onPrintAllUsabilityStudyLogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void writeMotionEvent(final MotionEvent me) {
|
||||||
|
final int action = me.getActionMasked();
|
||||||
|
final long eventTime = me.getEventTime();
|
||||||
|
final int pointerCount = me.getPointerCount();
|
||||||
|
for (int index = 0; index < pointerCount; index++) {
|
||||||
|
final int id = me.getPointerId(index);
|
||||||
|
final int x = (int)me.getX(index);
|
||||||
|
final int y = (int)me.getY(index);
|
||||||
|
final float size = me.getSize(index);
|
||||||
|
final float pressure = me.getPressure(index);
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
getInstance().write(eventTag + eventTime + "," + id + "," + x + "," + y + "," + size
|
||||||
|
+ "," + pressure);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void write(final String log) {
|
public void write(final String log) {
|
||||||
mLoggingHandler.post(new Runnable() {
|
mLoggingHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue