aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/research/ResearchLogger.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/research/ResearchLogger.java')
-rw-r--r--java/src/com/android/inputmethod/research/ResearchLogger.java33
1 files changed, 25 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java
index 535ce28f4..8fc62ea7b 100644
--- a/java/src/com/android/inputmethod/research/ResearchLogger.java
+++ b/java/src/com/android/inputmethod/research/ResearchLogger.java
@@ -191,10 +191,10 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
private Suggest mSuggest;
private MainKeyboardView mMainKeyboardView;
// TODO: Check whether a superclass can be used instead of LatinIME.
- private LatinIME mLatinIME;
+ /* package for test */ LatinIME mLatinIME;
private final Statistics mStatistics;
private final MotionEventReader mMotionEventReader = new MotionEventReader();
- private final Replayer mReplayer = new Replayer();
+ private final Replayer mReplayer = Replayer.getInstance();
private Intent mUploadIntent;
private Intent mUploadNowIntent;
@@ -798,7 +798,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
public void run() {
final ReplayData replayData =
mMotionEventReader.readMotionEventData(mUserRecordingFile);
- mReplayer.replay(replayData);
+ mReplayer.replay(replayData, null);
}
}, 1000);
}
@@ -846,7 +846,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
}
private boolean isAllowedToLog() {
- return !mIsPasswordView && !mIsLoggingSuspended && sIsLogging && !mInFeedbackDialog;
+ return !mIsPasswordView && !mIsLoggingSuspended && sIsLogging && !mInFeedbackDialog
+ && !isReplaying();
}
public void requestIndicatorRedraw() {
@@ -859,15 +860,30 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
mMainKeyboardView.invalidateAllKeys();
}
+ private boolean isReplaying() {
+ return mReplayer.isReplaying();
+ }
+
+ private int getIndicatorColor() {
+ if (isMakingUserRecording()) {
+ return Color.YELLOW;
+ }
+ if (isReplaying()) {
+ return Color.GREEN;
+ }
+ return Color.RED;
+ }
+
public void paintIndicator(KeyboardView view, Paint paint, Canvas canvas, int width,
int height) {
// TODO: Reimplement using a keyboard background image specific to the ResearchLogger
// and remove this method.
// The check for MainKeyboardView ensures that the indicator only decorates the main
// keyboard, not every keyboard.
- if (IS_SHOWING_INDICATOR && isAllowedToLog() && view instanceof MainKeyboardView) {
+ if (IS_SHOWING_INDICATOR && (isAllowedToLog() || isReplaying())
+ && view instanceof MainKeyboardView) {
final int savedColor = paint.getColor();
- paint.setColor(isMakingUserRecording() ? Color.YELLOW : Color.RED);
+ paint.setColor(getIndicatorColor());
final Style savedStyle = paint.getStyle();
paint.setStyle(Style.STROKE);
final float savedStrokeWidth = paint.getStrokeWidth();
@@ -1189,7 +1205,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
*
*/
private static final LogStatement LOGSTATEMENT_MAIN_KEYBOARD_VIEW_PROCESS_MOTION_EVENT =
- new LogStatement("MotionEvent", true, false, "action", "MotionEvent", "loggingRelated");
+ new LogStatement("MotionEvent", true, false, "action",
+ LogStatement.KEY_IS_LOGGING_RELATED, "motionEvent");
public static void mainKeyboardView_processMotionEvent(final MotionEvent me, final int action,
final long eventTime, final int index, final int id, final int x, final int y) {
if (me != null) {
@@ -1206,7 +1223,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
}
final ResearchLogger researchLogger = getInstance();
researchLogger.enqueueEvent(LOGSTATEMENT_MAIN_KEYBOARD_VIEW_PROCESS_MOTION_EVENT,
- actionString, MotionEvent.obtain(me), false);
+ actionString, false /* IS_LOGGING_RELATED */, MotionEvent.obtain(me));
if (action == MotionEvent.ACTION_DOWN) {
// Subtract 1 from eventTime so the down event is included in the later
// LogUnit, not the earlier (the test is for inequality).