am cadc0f7d: Merge "Send touch event in usability study mode"

* commit 'cadc0f7d7933f2b7c9a91314e15fdccc0ec6d49e':
  Send touch event in usability study mode
main
satok 2011-12-16 01:06:46 -08:00 committed by Android Git Automerger
commit 228a6095bd
2 changed files with 35 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import android.content.pm.PackageManager;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.os.Message; import android.os.Message;
import android.text.TextUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log; import android.util.Log;
import android.view.GestureDetector; import android.view.GestureDetector;
@ -38,9 +39,11 @@ import com.android.inputmethod.deprecated.VoiceProxy;
import com.android.inputmethod.keyboard.PointerTracker.DrawingProxy; import com.android.inputmethod.keyboard.PointerTracker.DrawingProxy;
import com.android.inputmethod.keyboard.PointerTracker.TimerProxy; import com.android.inputmethod.keyboard.PointerTracker.TimerProxy;
import com.android.inputmethod.latin.LatinIME; import com.android.inputmethod.latin.LatinIME;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.StaticInnerHandlerWrapper; import com.android.inputmethod.latin.StaticInnerHandlerWrapper;
import com.android.inputmethod.latin.Utils; import com.android.inputmethod.latin.Utils;
import com.android.inputmethod.latin.Utils.UsabilityStudyLogUtils;
import java.util.WeakHashMap; import java.util.WeakHashMap;
@ -62,6 +65,9 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
// Timing constants // Timing constants
private final int mKeyRepeatInterval; private final int mKeyRepeatInterval;
// TODO: Kill process when the usability study mode was changed.
private static final boolean ENABLE_USABILITY_STUDY_LOG = LatinImeLogger.sUsabilityStudy;
// Mini keyboard // Mini keyboard
private PopupWindow mMoreKeysWindow; private PopupWindow mMoreKeysWindow;
private MoreKeysPanel mMoreKeysPanel; private MoreKeysPanel mMoreKeysPanel;
@ -513,6 +519,30 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
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) {
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;
default:
eventTag = "[Action" + action + "]";
break;
}
if (!TextUtils.isEmpty(eventTag)) {
UsabilityStudyLogUtils.getInstance().write(
eventTag + eventTime + "," + id + "," + x + "," + y + "\t\t");
}
}
if (mKeyTimerHandler.isInKeyRepeat()) { if (mKeyTimerHandler.isInKeyRepeat()) {
final PointerTracker tracker = getPointerTracker(id); final PointerTracker tracker = getPointerTracker(id);
@ -569,6 +599,10 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
py = (int)me.getY(i); py = (int)me.getY(i);
} }
tracker.onMoveEvent(px, py, eventTime); tracker.onMoveEvent(px, py, eventTime);
if (ENABLE_USABILITY_STUDY_LOG) {
UsabilityStudyLogUtils.getInstance().write("[Move]" + eventTime + ","
+ me.getPointerId(i) + "," + px + "," + py + "\t\t");
}
} }
} else { } else {
getPointerTracker(id).processMotionEvent(action, x, y, eventTime, this); getPointerTracker(id).processMotionEvent(action, x, y, eventTime, this);

View File

@ -29,6 +29,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
public static boolean sDBG = false; public static boolean sDBG = false;
public static boolean sVISUALDEBUG = false; public static boolean sVISUALDEBUG = false;
public static boolean sUsabilityStudy = false;
@Override @Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {