diff options
| author | Kurt Partridge <kep@google.com> | 2012-03-30 13:15:46 -0700 |
|---|---|---|
| committer | Kurt Partridge <kep@google.com> | 2012-04-06 09:35:13 -0700 |
| commit | ac9e87c03ebbcbd70dd051a30ebf98d6baebedfc (patch) | |
| tree | 2217ba38beeb0204afa73df0ebfdba52168946b6 /java/src/com/android/inputmethod/keyboard | |
| parent | fe4807d52fb19656563c5ec22ad5eba3a51e1157 (diff) | |
add more data collection points to ResearchLogger
the new points are all at Log.x() positions; only those appearing directly
related to user input were added.
Bug: 6188932
Change-Id: I618bcd07b22c9efc794745678b073afe1e79a697
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard')
5 files changed, 92 insertions, 18 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java index 2689e6e13..98da1eb65 100644 --- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java @@ -555,6 +555,9 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke * method on the base class if the subclass doesn't wish to handle the call. */ protected boolean onLongPress(Key parentKey, PointerTracker tracker) { + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.latinKeyboardView_onLongPress(); + } final int primaryCode = parentKey.mCode; if (parentKey.hasEmbeddedMoreKey()) { final int embeddedCode = KeySpecParser.getCode(getResources(), parentKey.mMoreKeys[0]); @@ -695,17 +698,8 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke } } if (ProductionFlag.IS_EXPERIMENTAL) { - if (ResearchLogger.sIsLogging) { - // TODO: remove redundant calculations of size and pressure by - // removing UsabilityStudyLog code once the ResearchLogger is mature enough - final float size = me.getSize(index); - final float pressure = me.getPressure(index); - if (action != MotionEvent.ACTION_MOVE) { - // Skip ACTION_MOVE events as they are logged below - ResearchLogger.getInstance().logMotionEvent(action, eventTime, id, x, y, - size, pressure); - } - } + ResearchLogger.latinKeyboardView_processMotionEvent(me, action, eventTime, index, id, + x, y); } if (mKeyTimerHandler.isInKeyRepeat()) { @@ -773,13 +767,8 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke + pointerSize + "," + pointerPressure); } if (ProductionFlag.IS_EXPERIMENTAL) { - if (ResearchLogger.sIsLogging) { - // TODO: earlier comment about redundant calculations applies here too - final float pointerSize = me.getSize(i); - final float pointerPressure = me.getPressure(i); - ResearchLogger.getInstance().logMotionEvent(action, eventTime, pointerId, - px, py, pointerSize, pointerPressure); - } + ResearchLogger.latinKeyboardView_processMotionEvent(me, action, eventTime, + i, pointerId, px, py); } } } else { diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java index ec9081681..24ab54730 100644 --- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java +++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java @@ -23,6 +23,8 @@ import android.widget.TextView; import com.android.inputmethod.keyboard.internal.PointerTrackerQueue; import com.android.inputmethod.latin.LatinImeLogger; +import com.android.inputmethod.latin.ResearchLogger; +import com.android.inputmethod.latin.define.ProductionFlag; import java.util.ArrayList; @@ -235,6 +237,10 @@ public class PointerTracker { + " ignoreModifier=" + ignoreModifierKey + " enabled=" + key.isEnabled()); } + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.pointerTracker_callListenerOnPressAndCheckKeyboardLayoutChange(key, + ignoreModifierKey); + } if (ignoreModifierKey) { return false; } @@ -259,6 +265,10 @@ public class PointerTracker { + " ignoreModifier=" + ignoreModifierKey + " altersCode=" + altersCode + " enabled=" + key.isEnabled()); } + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.pointerTracker_callListenerOnCodeInput(key, x, y, ignoreModifierKey, + altersCode, code); + } if (ignoreModifierKey) { return; } @@ -284,6 +294,10 @@ public class PointerTracker { + " sliding=" + withSliding + " ignoreModifier=" + ignoreModifierKey + " enabled="+ key.isEnabled()); } + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.pointerTracker_callListenerOnRelease(key, primaryCode, withSliding, + ignoreModifierKey); + } if (ignoreModifierKey) { return; } @@ -295,6 +309,9 @@ public class PointerTracker { private void callListenerOnCancelInput() { if (DEBUG_LISTENER) Log.d(TAG, "onCancelInput"); + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.pointerTracker_callListenerOnCancelInput(); + } mListener.onCancelInput(); } @@ -479,6 +496,9 @@ public class PointerTracker { if (DEBUG_MODE) Log.w(TAG, "onDownEvent: ignore potential noise: time=" + deltaT + " distance=" + distanceSquared); + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.pointerTracker_onDownEvent(deltaT, distanceSquared); + } mKeyAlreadyProcessed = true; return; } @@ -583,6 +603,9 @@ public class PointerTracker { if (DEBUG_MODE) Log.w(TAG, String.format("onMoveEvent: sudden move is translated to " + "up[%d,%d]/down[%d,%d] events", lastX, lastY, x, y)); + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.pointerTracker_onMoveEvent(x, y, lastX, lastY); + } onUpEventInternal(lastX, lastY, eventTime); onDownEventInternal(x, y, eventTime); } else { diff --git a/java/src/com/android/inputmethod/keyboard/SuddenJumpingTouchEventHandler.java b/java/src/com/android/inputmethod/keyboard/SuddenJumpingTouchEventHandler.java index 347383f95..107138395 100644 --- a/java/src/com/android/inputmethod/keyboard/SuddenJumpingTouchEventHandler.java +++ b/java/src/com/android/inputmethod/keyboard/SuddenJumpingTouchEventHandler.java @@ -22,7 +22,9 @@ import android.view.MotionEvent; import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.R; +import com.android.inputmethod.latin.ResearchLogger; import com.android.inputmethod.latin.Utils; +import com.android.inputmethod.latin.define.ProductionFlag; public class SuddenJumpingTouchEventHandler { private static final String TAG = SuddenJumpingTouchEventHandler.class.getSimpleName(); @@ -141,6 +143,9 @@ public class SuddenJumpingTouchEventHandler { if (handleSuddenJumping(me)) { if (DEBUG_MODE) Log.w(TAG, "onTouchEvent: ignore sudden jump " + me); + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.suddenJumpingTouchEventHandler_onTouchEvent(me); + } return true; } return mView.processMotionEvent(me); diff --git a/java/src/com/android/inputmethod/keyboard/internal/AlphabetShiftState.java b/java/src/com/android/inputmethod/keyboard/internal/AlphabetShiftState.java index 5712df1fc..392afca97 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/AlphabetShiftState.java +++ b/java/src/com/android/inputmethod/keyboard/internal/AlphabetShiftState.java @@ -18,6 +18,9 @@ package com.android.inputmethod.keyboard.internal; import android.util.Log; +import com.android.inputmethod.latin.ResearchLogger; +import com.android.inputmethod.latin.define.ProductionFlag; + public class AlphabetShiftState { private static final String TAG = AlphabetShiftState.class.getSimpleName(); private static final boolean DEBUG = false; @@ -59,6 +62,9 @@ public class AlphabetShiftState { } if (DEBUG) Log.d(TAG, "setShifted(" + newShiftState + "): " + toString(oldState) + " > " + this); + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.alphabetShiftState_setShifted(newShiftState, oldState, this); + } } public void setShiftLocked(boolean newShiftLockState) { @@ -78,6 +84,9 @@ public class AlphabetShiftState { if (DEBUG) Log.d(TAG, "setShiftLocked(" + newShiftLockState + "): " + toString(oldState) + " > " + this); + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.alphabetShiftState_setShiftLocked(newShiftLockState, oldState, this); + } } public void setAutomaticShifted() { @@ -85,6 +94,9 @@ public class AlphabetShiftState { mState = AUTOMATIC_SHIFTED; if (DEBUG) Log.d(TAG, "setAutomaticShifted: " + toString(oldState) + " > " + this); + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.alphabetShiftState_setAutomaticShifted(oldState, this); + } } public boolean isShiftedOrShiftLocked() { diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java index 18a3f9794..6949c9d12 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java @@ -20,6 +20,8 @@ import android.text.TextUtils; import android.util.Log; import com.android.inputmethod.keyboard.Keyboard; +import com.android.inputmethod.latin.ResearchLogger; +import com.android.inputmethod.latin.define.ProductionFlag; /** * Keyboard state machine. @@ -139,6 +141,9 @@ public class KeyboardState { if (DEBUG_EVENT) { Log.d(TAG, "onSaveKeyboardState: saved=" + state + " " + this); } + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.keyboardState_onSaveKeyboardState(this, state.toString()); + } } private void onRestoreKeyboardState() { @@ -146,6 +151,9 @@ public class KeyboardState { if (DEBUG_EVENT) { Log.d(TAG, "onRestoreKeyboardState: saved=" + state + " " + this); } + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.keyboardState_onRestoreKeyboardState(this, state.toString()); + } if (!state.mIsValid || state.mIsAlphabetMode) { setAlphabetKeyboard(); } else { @@ -178,6 +186,9 @@ public class KeyboardState { if (DEBUG_ACTION) { Log.d(TAG, "setShifted: shiftMode=" + shiftModeToString(shiftMode) + " " + this); } + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.keyboardState_setShifted(this, shiftModeToString(shiftMode)); + } if (!mIsAlphabetMode) return; final int prevShiftMode; if (mAlphabetShiftState.isAutomaticShifted()) { @@ -217,6 +228,9 @@ public class KeyboardState { if (DEBUG_ACTION) { Log.d(TAG, "setShiftLocked: shiftLocked=" + shiftLocked + " " + this); } + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.keyboardState_setShiftLocked(this, shiftLocked); + } if (!mIsAlphabetMode) return; if (shiftLocked && (!mAlphabetShiftState.isShiftLocked() || mAlphabetShiftState.isShiftLockShifted())) { @@ -232,6 +246,9 @@ public class KeyboardState { if (DEBUG_ACTION) { Log.d(TAG, "toggleAlphabetAndSymbols: " + this); } + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.keyboardState_toggleAlphabetAndSymbols(this); + } if (mIsAlphabetMode) { mPrevMainKeyboardWasShiftLocked = mAlphabetShiftState.isShiftLocked(); if (mPrevSymbolsKeyboardWasShifted) { @@ -262,6 +279,10 @@ public class KeyboardState { if (DEBUG_ACTION) { Log.d(TAG, "setAlphabetKeyboard"); } + + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.keyboardState_setAlphabetKeyboard(); + } mSwitchActions.setAlphabetKeyboard(); mIsAlphabetMode = true; mIsSymbolShifted = false; @@ -273,6 +294,9 @@ public class KeyboardState { if (DEBUG_ACTION) { Log.d(TAG, "setSymbolsKeyboard"); } + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.keyboardState_setSymbolsKeyboard(); + } mSwitchActions.setSymbolsKeyboard(); mIsAlphabetMode = false; mIsSymbolShifted = false; @@ -285,6 +309,9 @@ public class KeyboardState { if (DEBUG_ACTION) { Log.d(TAG, "setSymbolsShiftedKeyboard"); } + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.keyboardState_setSymbolsShiftedKeyboard(); + } mSwitchActions.setSymbolsShiftedKeyboard(); mIsAlphabetMode = false; mIsSymbolShifted = true; @@ -297,6 +324,9 @@ public class KeyboardState { if (DEBUG_EVENT) { Log.d(TAG, "onPressKey: code=" + Keyboard.printableCode(code) + " " + this); } + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.keyboardState_onPressKey(code, this); + } if (code == Keyboard.CODE_SHIFT) { onPressShift(); } else if (code == Keyboard.CODE_SWITCH_ALPHA_SYMBOL) { @@ -314,6 +344,9 @@ public class KeyboardState { Log.d(TAG, "onReleaseKey: code=" + Keyboard.printableCode(code) + " sliding=" + withSliding + " " + this); } + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.keyboardState_onReleaseKey(this, code, withSliding); + } if (code == Keyboard.CODE_SHIFT) { onReleaseShift(withSliding); } else if (code == Keyboard.CODE_SWITCH_ALPHA_SYMBOL) { @@ -345,6 +378,9 @@ public class KeyboardState { if (DEBUG_EVENT) { Log.d(TAG, "onLongPressTimeout: code=" + Keyboard.printableCode(code) + " " + this); } + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.keyboardState_onLongPressTimeout(code, this); + } if (mIsAlphabetMode && code == Keyboard.CODE_SHIFT) { if (mAlphabetShiftState.isShiftLocked()) { setShiftLocked(false); @@ -363,6 +399,9 @@ public class KeyboardState { if (DEBUG_EVENT) { Log.d(TAG, "onUpdateShiftState: autoCaps=" + autoCaps + " " + this); } + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.keyboardState_onUpdateShiftState(this, autoCaps); + } updateAlphabetShiftState(autoCaps); } @@ -481,6 +520,9 @@ public class KeyboardState { if (DEBUG_EVENT) { Log.d(TAG, "onCancelInput: single=" + isSinglePointer + " " + this); } + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.keyboardState_onCancelInput(isSinglePointer, this); + } // Switch back to the previous keyboard mode if the user cancels sliding input. if (isSinglePointer) { if (mSwitchState == SWITCH_STATE_MOMENTARY_ALPHA_AND_SYMBOL) { @@ -512,6 +554,9 @@ public class KeyboardState { + " single=" + isSinglePointer + " autoCaps=" + autoCaps + " " + this); } + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.keyboardState_onCodeInput(code, isSinglePointer, autoCaps, this); + } switch (mSwitchState) { case SWITCH_STATE_MOMENTARY_ALPHA_AND_SYMBOL: |
