diff options
author | 2012-04-06 18:26:34 -0700 | |
---|---|---|
committer | 2012-04-06 18:26:34 -0700 | |
commit | d16bda4a4a307c8f8fd8d25c3984aaf307d49af5 (patch) | |
tree | a38cdbc7aca15c7da9411eb533cd0e0108def032 /java/src/com/android/inputmethod/latin/ResearchLogger.java | |
parent | ac9e87c03ebbcbd70dd051a30ebf98d6baebedfc (diff) | |
download | latinime-d16bda4a4a307c8f8fd8d25c3984aaf307d49af5.tar.gz latinime-d16bda4a4a307c8f8fd8d25c3984aaf307d49af5.tar.xz latinime-d16bda4a4a307c8f8fd8d25c3984aaf307d49af5.zip |
Revert "add more data collection points to ResearchLogger"
This reverts commit ac9e87c03ebbcbd70dd051a30ebf98d6baebedfc
Diffstat (limited to 'java/src/com/android/inputmethod/latin/ResearchLogger.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/ResearchLogger.java | 441 |
1 files changed, 45 insertions, 396 deletions
diff --git a/java/src/com/android/inputmethod/latin/ResearchLogger.java b/java/src/com/android/inputmethod/latin/ResearchLogger.java index 182a7bc3e..c5fb61f78 100644 --- a/java/src/com/android/inputmethod/latin/ResearchLogger.java +++ b/java/src/com/android/inputmethod/latin/ResearchLogger.java @@ -25,20 +25,15 @@ import android.os.SystemClock; import android.text.TextUtils; import android.util.Log; import android.view.MotionEvent; -import android.view.inputmethod.CompletionInfo; -import android.view.inputmethod.EditorInfo; -import com.android.inputmethod.keyboard.Key; -import com.android.inputmethod.keyboard.KeyDetector; import com.android.inputmethod.keyboard.Keyboard; -import com.android.inputmethod.keyboard.internal.AlphabetShiftState; -import com.android.inputmethod.keyboard.internal.KeyboardState; -import com.android.inputmethod.latin.define.ProductionFlag; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintWriter; +import java.text.SimpleDateFormat; +import java.util.Date; /** * Logs the use of the LatinIME keyboard. @@ -51,12 +46,13 @@ import java.io.PrintWriter; public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChangeListener { private static final String TAG = ResearchLogger.class.getSimpleName(); private static final String PREF_USABILITY_STUDY_MODE = "usability_study_mode"; - private static final boolean DEBUG = false; private static final ResearchLogger sInstance = new ResearchLogger(new LogFileManager()); public static boolean sIsLogging = false; /* package */ final Handler mLoggingHandler; private InputMethodService mIms; + private final Date mDate; + private final SimpleDateFormat mDateFormat; /** * Isolates management of files. This variable should never be null, but can be changed @@ -83,36 +79,35 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang /* package */ LogFileManager() { } - public void init(final InputMethodService ims) { + public void init(InputMethodService ims) { mIms = ims; } - public synchronized boolean createLogFile() { + public synchronized void createLogFile() { try { - return createLogFile(DEFAULT_LOG_DIRECTORY, DEFAULT_FILENAME); - } catch (final FileNotFoundException e) { + createLogFile(DEFAULT_LOG_DIRECTORY, DEFAULT_FILENAME); + } catch (FileNotFoundException e) { Log.w(TAG, e); - return false; } } - public synchronized boolean createLogFile(final String dir, final String filename) + public synchronized void createLogFile(String dir, String filename) throws FileNotFoundException { if (mIms == null) { Log.w(TAG, "InputMethodService is not configured. Logging is off."); - return false; + return; } - final File filesDir = mIms.getFilesDir(); + File filesDir = mIms.getFilesDir(); if (filesDir == null || !filesDir.exists()) { Log.w(TAG, "Storage directory does not exist. Logging is off."); - return false; + return; } - final File directory = new File(filesDir, dir); + File directory = new File(filesDir, dir); if (!directory.exists()) { - final boolean wasCreated = directory.mkdirs(); + boolean wasCreated = directory.mkdirs(); if (!wasCreated) { Log.w(TAG, "Log directory cannot be created. Logging is off."); - return false; + return; } } @@ -125,23 +120,16 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang append = false; } mPrintWriter = new PrintWriter(new FileOutputStream(mFile, append), true); - return true; } - public synchronized boolean append(final String s) { + public synchronized boolean append(String s) { if (mPrintWriter == null) { - if (DEBUG) { - Log.w(TAG, "PrintWriter is null... attempting to create default log file"); - } - if (!createLogFile()) { - if (DEBUG) { - Log.w(TAG, "Failed to create log file. Not logging."); - return false; - } - } + Log.w(TAG, "PrintWriter is null"); + return false; + } else { + mPrintWriter.print(s); + return !mPrintWriter.checkError(); } - mPrintWriter.print(s); - return !mPrintWriter.checkError(); } public synchronized void reset() { @@ -164,8 +152,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang } } - private ResearchLogger(final LogFileManager logFileManager) { - final HandlerThread handlerThread = new HandlerThread("ResearchLogger logging task", + private ResearchLogger(LogFileManager logFileManager) { + mDate = new Date(); + mDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss.SSSZ"); + + HandlerThread handlerThread = new HandlerThread("ResearchLogger logging task", Process.THREAD_PRIORITY_BACKGROUND); handlerThread.start(); mLoggingHandler = new Handler(handlerThread.getLooper()); @@ -176,11 +167,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang return sInstance; } - public static void init(final InputMethodService ims, final SharedPreferences prefs) { + public static void init(InputMethodService ims, SharedPreferences prefs) { sInstance.initInternal(ims, prefs); } - public void initInternal(final InputMethodService ims, final SharedPreferences prefs) { + public void initInternal(InputMethodService ims, SharedPreferences prefs) { mIms = ims; if (mLogFileManager != null) { mLogFileManager.init(ims); @@ -197,7 +188,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang * * @throws IllegalArgumentException if logFileManager is null */ - void setLogFileManager(final LogFileManager manager) { + void setLogFileManager(LogFileManager manager) { if (manager == null) { throw new IllegalArgumentException("warning: trying to set null logFileManager"); } else { @@ -212,12 +203,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang MOTION_EVENT("m"), KEY("k"), CORRECTION("c"), - STATE_CHANGE("s"), - UNSTRUCTURED("u"); + STATE_CHANGE("s"); private final String mLogString; - private LogGroup(final String logString) { + private LogGroup(String logString) { mLogString = logString; } } @@ -236,7 +226,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang default: eventTag = "[Action" + action + "]"; break; } if (!TextUtils.isEmpty(eventTag)) { - final StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); sb.append(eventTag); sb.append('\t'); sb.append(eventTime); sb.append('\t'); sb.append(id); @@ -248,7 +238,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang } } - public void logKeyEvent(final int code, final int x, final int y) { + public void logKeyEvent(int code, int x, int y) { final StringBuilder sb = new StringBuilder(); sb.append(Keyboard.printableCode(code)); sb.append('\t'); sb.append(x); @@ -256,8 +246,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang write(LogGroup.KEY, sb.toString()); } - public void logCorrection(final String subgroup, final String before, final String after, - final int position) { + public void logCorrection(String subgroup, String before, String after, int position) { final StringBuilder sb = new StringBuilder(); sb.append(subgroup); sb.append('\t'); sb.append(before); @@ -266,62 +255,19 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang write(LogGroup.CORRECTION, sb.toString()); } - public void logStateChange(final String subgroup, final String details) { + public void logStateChange(String subgroup, String details) { write(LogGroup.STATE_CHANGE, subgroup + "\t" + details); } - public static class UnsLogGroup { - private static final boolean DEFAULT_ENABLED = true; - - private static final boolean ALPHABETSHIFTSTATE_SETSHIFTED_ENABLED = DEFAULT_ENABLED; - private static final boolean ALPHABETSHIFTSTATE_SETSHIFTLOCKED_ENABLED = DEFAULT_ENABLED; - private static final boolean ALPHABETSHIFTSTATE_SETAUTOMATICSHIFTED_ENABLED - = DEFAULT_ENABLED; - private static final boolean AUTOCORRECTION_HASAUTOCORRECTIONFORBINARYDICTIONARY_ENABLED - = DEFAULT_ENABLED; - private static final boolean - AUTOCORRECTION_HASAUTOCORRECTIONFORBINARYDICTIONARY_BYSTHRESHOLD_ENABLED - = DEFAULT_ENABLED; - private static final boolean KEYBOARDSTATE_ONCANCELINPUT_ENABLED = DEFAULT_ENABLED; - private static final boolean KEYBOARDSTATE_ONCODEINPUT_ENABLED = DEFAULT_ENABLED; - private static final boolean KEYBOARDSTATE_ONLONGPRESSTIMEOUT_ENABLED = DEFAULT_ENABLED; - private static final boolean KEYBOARDSTATE_ONPRESSKEY_ENABLED = DEFAULT_ENABLED; - private static final boolean KEYBOARDSTATE_ONRELEASEKEY_ENABLED = DEFAULT_ENABLED; - private static final boolean KEYBOARDSTATE_ONRESTOREKEYBOARDSTATE_ENABLED = DEFAULT_ENABLED; - private static final boolean KEYBOARDSTATE_ONSAVEKEYBOARDSTATE_ENABLED = DEFAULT_ENABLED; - private static final boolean KEYBOARDSTATE_ONUPDATESHIFTSTATE_ENABLED = DEFAULT_ENABLED; - private static final boolean KEYBOARDSTATE_SETALPHABETKEYBOARD_ENABLED = DEFAULT_ENABLED; - private static final boolean KEYBOARDSTATE_SETSHIFTED_ENABLED = DEFAULT_ENABLED; - private static final boolean KEYBOARDSTATE_SETSHIFTLOCKED_ENABLED = DEFAULT_ENABLED; - private static final boolean KEYBOARDSTATE_SETSYMBOLSKEYBOARD_ENABLED = DEFAULT_ENABLED; - private static final boolean KEYBOARDSTATE_SETSYMBOLSSHIFTEDKEYBOARD_ENABLED - = DEFAULT_ENABLED; - private static final boolean KEYBOARDSTATE_TOGGLEALPHABETANDSYMBOLS_ENABLED - = DEFAULT_ENABLED; - private static final boolean LATINIME_ONDISPLAYCOMPLETIONS_ENABLED = DEFAULT_ENABLED; - private static final boolean LATINIME_ONSTARTINPUTVIEWINTERNAL_ENABLED = DEFAULT_ENABLED; - private static final boolean LATINIME_ONUPDATESELECTION_ENABLED = DEFAULT_ENABLED; - private static final boolean LATINIME_SWITCHTOKEYBOARDVIEW_ENABLED = DEFAULT_ENABLED; - private static final boolean LATINKEYBOARDVIEW_ONLONGPRESS_ENABLED = DEFAULT_ENABLED; - private static final boolean LATINKEYBOARDVIEW_ONPROCESSMOTIONEVENT_ENABLED - = DEFAULT_ENABLED; - private static final boolean POINTERTRACKER_CALLLISTENERONCANCELINPUT_ENABLED - = DEFAULT_ENABLED; - private static final boolean POINTERTRACKER_CALLLISTENERONCODEINPUT_ENABLED - = DEFAULT_ENABLED; - private static final boolean - POINTERTRACKER_CALLLISTENERONPRESSANDCHECKKEYBOARDLAYOUTCHANGE_ENABLED - = DEFAULT_ENABLED; - private static final boolean POINTERTRACKER_CALLLISTENERONRELEASE_ENABLED = DEFAULT_ENABLED; - private static final boolean POINTERTRACKER_ONDOWNEVENT_ENABLED = DEFAULT_ENABLED; - private static final boolean POINTERTRACKER_ONMOVEEVENT_ENABLED = DEFAULT_ENABLED; - private static final boolean SUDDENJUMPINGTOUCHEVENTHANDLER_ONTOUCHEVENT_ENABLED - = DEFAULT_ENABLED; + public static enum UnsLogGroup { + // TODO: expand to include one flag per log point + // TODO: support selective enabling of flags + ON_UPDATE_SELECTION; + + public boolean isEnabled = true; } - public static void logUnstructured(String logGroup, final String details) { - // TODO: improve performance by making entire class static and/or implementing natively - getInstance().write(LogGroup.UNSTRUCTURED, logGroup + "\t" + details); + public static void logUnstructured(UnsLogGroup logGroup, String details) { } private void write(final LogGroup logGroup, final String log) { @@ -336,14 +282,13 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang builder.append('\t'); builder.append(upTime); builder.append('\t'); builder.append(logGroup.mLogString); builder.append('\t'); builder.append(log); - builder.append('\n'); - if (DEBUG) { + if (LatinImeLogger.sDBG) { Log.d(TAG, "Write: " + '[' + logGroup.mLogString + ']' + log); } if (mLogFileManager.append(builder.toString())) { // success } else { - if (DEBUG) { + if (LatinImeLogger.sDBG) { Log.w(TAG, "Unable to write to log."); } } @@ -355,7 +300,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang mLoggingHandler.post(new Runnable() { @Override public void run() { - if (DEBUG) { + if (LatinImeLogger.sDBG) { Log.d(TAG, "Delete log file."); } mLogFileManager.reset(); @@ -370,300 +315,4 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang } sIsLogging = prefs.getBoolean(PREF_USABILITY_STUDY_MODE, false); } - - public static void alphabetShiftState_setShifted(final boolean newShiftState, - final int oldState, final AlphabetShiftState alphabetShiftState) { - if (UnsLogGroup.ALPHABETSHIFTSTATE_SETSHIFTED_ENABLED) { - final String s = "setShifted(" + newShiftState + "): " + oldState - + " > " + alphabetShiftState; - logUnstructured("AlphabetShiftState_setShifted", s); - } - } - - public static void alphabetShiftState_setShiftLocked(final boolean newShiftLockState, - final int oldState, final AlphabetShiftState alphabetShiftState) { - if (UnsLogGroup.ALPHABETSHIFTSTATE_SETSHIFTLOCKED_ENABLED) { - final String s = "setShiftLocked(" + newShiftLockState + "): " - + oldState + " > " + alphabetShiftState; - logUnstructured("AlphabetShiftState_setShiftLocked", s); - } - } - - public static void alphabetShiftState_setAutomaticShifted(final int oldState, - final AlphabetShiftState alphabetShiftState) { - if (UnsLogGroup.ALPHABETSHIFTSTATE_SETAUTOMATICSHIFTED_ENABLED) { - final String s = "setAutomaticShifted: " + oldState + " > " + alphabetShiftState; - logUnstructured("AlphabetShiftState_setAutomaticShifted", s); - } - } - - public static void autoCorrection_hasAutoCorrectionForBinaryDictionary( - final CharSequence consideredWord, final double autoCorrectionThreshold, - final CharSequence autoCorrectionSuggestion, final int autoCorrectionSuggestionScore, - final double normalizedScore) { - if (UnsLogGroup.AUTOCORRECTION_HASAUTOCORRECTIONFORBINARYDICTIONARY_ENABLED) { - final String s = "Normalized " + consideredWord + "," - + autoCorrectionSuggestion + "," + autoCorrectionSuggestionScore - + ", " + normalizedScore + "(" + autoCorrectionThreshold + ")"; - logUnstructured("AutoCorrection_hasAutoCorrectionForBinaryDictionary", s); - } - } - - public static void autoCorrection_hasAutoCorrectionForBinaryDictionary_bySthreshold() { - if (UnsLogGroup.AUTOCORRECTION_HASAUTOCORRECTIONFORBINARYDICTIONARY_BYSTHRESHOLD_ENABLED) { - final String s = "Auto corrected by S-threshold."; - logUnstructured("AutoCorrection_hasAutoCorrectionForBinaryDictionar_bySthreshold", s); - } - } - - public static void keyboardState_onCancelInput(final boolean isSinglePointer, - final KeyboardState keyboardState) { - if (UnsLogGroup.KEYBOARDSTATE_ONCANCELINPUT_ENABLED) { - final String s = "onCancelInput: single=" + isSinglePointer + " " + keyboardState; - logUnstructured("KeyboardState_onCancelInput", s); - } - } - - public static void keyboardState_onCodeInput( - final int code, final boolean isSinglePointer, final boolean autoCaps, - final KeyboardState keyboardState) { - if (UnsLogGroup.KEYBOARDSTATE_ONCODEINPUT_ENABLED) { - final String s = "onCodeInput: code=" + Keyboard.printableCode(code) - + " single=" + isSinglePointer - + " autoCaps=" + autoCaps + " " + keyboardState; - logUnstructured("KeyboardState_onCodeInput", s); - } - } - - public static void keyboardState_onLongPressTimeout(final int code, - final KeyboardState keyboardState) { - if (UnsLogGroup.KEYBOARDSTATE_ONLONGPRESSTIMEOUT_ENABLED) { - final String s = "onLongPressTimeout: code=" + Keyboard.printableCode(code) + " " - + keyboardState; - logUnstructured("KeyboardState_onLongPressTimeout", s); - } - } - - public static void keyboardState_onPressKey(final int code, - final KeyboardState keyboardState) { - if (UnsLogGroup.KEYBOARDSTATE_ONPRESSKEY_ENABLED) { - final String s = "onPressKey: code=" + Keyboard.printableCode(code) + " " - + keyboardState; - logUnstructured("KeyboardState_onPressKey", s); - } - } - - public static void keyboardState_onReleaseKey(final KeyboardState keyboardState, final int code, - final boolean withSliding) { - if (UnsLogGroup.KEYBOARDSTATE_ONRELEASEKEY_ENABLED) { - final String s = "onReleaseKey: code=" + Keyboard.printableCode(code) - + " sliding=" + withSliding + " " + keyboardState; - logUnstructured("KeyboardState_onReleaseKey", s); - } - } - - public static void keyboardState_onRestoreKeyboardState(final KeyboardState keyboardState, - final String savedKeyboardState) { - if (UnsLogGroup.KEYBOARDSTATE_ONRESTOREKEYBOARDSTATE_ENABLED) { - final String s = "onRestoreKeyboardState: saved=" + savedKeyboardState + " " - + keyboardState; - logUnstructured("KeyboardState_onRestoreKeyboardState", s); - } - } - - public static void keyboardState_onSaveKeyboardState(final KeyboardState keyboardState, - final String savedKeyboardState) { - if (UnsLogGroup.KEYBOARDSTATE_ONSAVEKEYBOARDSTATE_ENABLED) { - final String s = "onSaveKeyboardState: saved=" + savedKeyboardState + " " - + keyboardState; - logUnstructured("KeyboardState_onSaveKeyboardState", s); - } - } - - public static void keyboardState_onUpdateShiftState(final KeyboardState keyboardState, - final boolean autoCaps) { - if (UnsLogGroup.KEYBOARDSTATE_ONUPDATESHIFTSTATE_ENABLED) { - final String s = "onUpdateShiftState: autoCaps=" + autoCaps + " " + keyboardState; - logUnstructured("KeyboardState_onUpdateShiftState", s); - } - } - - public static void keyboardState_setAlphabetKeyboard() { - if (UnsLogGroup.KEYBOARDSTATE_SETALPHABETKEYBOARD_ENABLED) { - final String s = "setAlphabetKeyboard"; - logUnstructured("KeyboardState_setAlphabetKeyboard", s); - } - } - - public static void keyboardState_setShifted(final KeyboardState keyboardState, - final String shiftMode) { - if (UnsLogGroup.KEYBOARDSTATE_SETSHIFTED_ENABLED) { - final String s = "setShifted: shiftMode=" + shiftMode + " " + keyboardState; - logUnstructured("KeyboardState_setShifted", s); - } - } - - public static void keyboardState_setShiftLocked(final KeyboardState keyboardState, - final boolean shiftLocked) { - if (UnsLogGroup.KEYBOARDSTATE_SETSHIFTLOCKED_ENABLED) { - final String s = "setShiftLocked: shiftLocked=" + shiftLocked + " " + keyboardState; - logUnstructured("KeyboardState_setShiftLocked", s); - } - } - - public static void keyboardState_setSymbolsKeyboard() { - if (UnsLogGroup.KEYBOARDSTATE_SETSYMBOLSKEYBOARD_ENABLED) { - final String s = "setSymbolsKeyboard"; - logUnstructured("KeyboardState_setSymbolsKeyboard", s); - } - } - - public static void keyboardState_setSymbolsShiftedKeyboard() { - if (UnsLogGroup.KEYBOARDSTATE_SETSYMBOLSSHIFTEDKEYBOARD_ENABLED) { - final String s = "setSymbolsShiftedKeyboard"; - logUnstructured("KeyboardState_setSymbolsShiftedKeyboard", s); - } - } - - public static void keyboardState_toggleAlphabetAndSymbols(final KeyboardState keyboardState) { - if (UnsLogGroup.KEYBOARDSTATE_TOGGLEALPHABETANDSYMBOLS_ENABLED) { - final String s = "toggleAlphabetAndSymbols: " + keyboardState; - logUnstructured("KeyboardState_toggleAlphabetAndSymbols", s); - } - } - - public static void latinIME_onDisplayCompletions( - final CompletionInfo[] applicationSpecifiedCompletions) { - if (UnsLogGroup.LATINIME_ONDISPLAYCOMPLETIONS_ENABLED) { - final StringBuilder builder = new StringBuilder(); - builder.append("Received completions:"); - if (applicationSpecifiedCompletions != null) { - for (int i = 0; i < applicationSpecifiedCompletions.length; i++) { - builder.append(" #"); - builder.append(i); - builder.append(": "); - builder.append(applicationSpecifiedCompletions[i]); - builder.append("\n"); - } - } - logUnstructured("LatinIME_onDisplayCompletions", builder.toString()); - } - } - - public static void latinIME_onStartInputViewInternal(final EditorInfo editorInfo) { - if (UnsLogGroup.LATINIME_ONSTARTINPUTVIEWINTERNAL_ENABLED) { - final StringBuilder builder = new StringBuilder(); - builder.append("onStartInputView: editorInfo:"); - builder.append("inputType="); - builder.append(editorInfo.inputType); - builder.append("imeOptions="); - builder.append(editorInfo.imeOptions); - logUnstructured("LatinIME_onStartInputViewInternal", builder.toString()); - } - } - - public static void latinIME_onUpdateSelection(final int lastSelectionStart, - final int lastSelectionEnd, final int oldSelStart, final int oldSelEnd, - final int newSelStart, final int newSelEnd, final int composingSpanStart, - final int composingSpanEnd) { - if (UnsLogGroup.LATINIME_ONUPDATESELECTION_ENABLED) { - final String s = "onUpdateSelection: oss=" + oldSelStart - + ", ose=" + oldSelEnd - + ", lss=" + lastSelectionStart - + ", lse=" + lastSelectionEnd - + ", nss=" + newSelStart - + ", nse=" + newSelEnd - + ", cs=" + composingSpanStart - + ", ce=" + composingSpanEnd; - logUnstructured("LatinIME_onUpdateSelection", s); - } - } - - public static void latinIME_switchToKeyboardView() { - if (UnsLogGroup.LATINIME_SWITCHTOKEYBOARDVIEW_ENABLED) { - final String s = "Switch to keyboard view."; - logUnstructured("LatinIME_switchToKeyboardView", s); - } - } - - public static void latinKeyboardView_onLongPress() { - if (UnsLogGroup.LATINKEYBOARDVIEW_ONLONGPRESS_ENABLED) { - final String s = "long press detected"; - logUnstructured("LatinKeyboardView_onLongPress", s); - } - } - - public static void latinKeyboardView_processMotionEvent(MotionEvent me, int action, - long eventTime, int index, int id, int x, int y) { - if (UnsLogGroup.LATINKEYBOARDVIEW_ONPROCESSMOTIONEVENT_ENABLED) { - final float size = me.getSize(index); - final float pressure = me.getPressure(index); - if (action != MotionEvent.ACTION_MOVE) { - getInstance().logMotionEvent(action, eventTime, id, x, y, size, pressure); - } - } - } - - public static void pointerTracker_callListenerOnCancelInput() { - final String s = "onCancelInput"; - if (UnsLogGroup.POINTERTRACKER_CALLLISTENERONCANCELINPUT_ENABLED) { - logUnstructured("PointerTracker_callListenerOnCancelInput", s); - } - } - - public static void pointerTracker_callListenerOnCodeInput(final Key key, final int x, - final int y, final boolean ignoreModifierKey, final boolean altersCode, - final int code) { - if (UnsLogGroup.POINTERTRACKER_CALLLISTENERONCODEINPUT_ENABLED) { - final String s = "onCodeInput: " + Keyboard.printableCode(code) - + " text=" + key.mOutputText + " x=" + x + " y=" + y - + " ignoreModifier=" + ignoreModifierKey + " altersCode=" + altersCode - + " enabled=" + key.isEnabled(); - logUnstructured("PointerTracker_callListenerOnCodeInput", s); - } - } - - public static void pointerTracker_callListenerOnPressAndCheckKeyboardLayoutChange( - final Key key, final boolean ignoreModifierKey) { - if (UnsLogGroup.POINTERTRACKER_CALLLISTENERONPRESSANDCHECKKEYBOARDLAYOUTCHANGE_ENABLED) { - final String s = "onPress : " + KeyDetector.printableCode(key) - + " ignoreModifier=" + ignoreModifierKey - + " enabled=" + key.isEnabled(); - logUnstructured("PointerTracker_callListenerOnPressAndCheckKeyboardLayoutChange", s); - } - } - - public static void pointerTracker_callListenerOnRelease(final Key key, final int primaryCode, - final boolean withSliding, final boolean ignoreModifierKey) { - if (UnsLogGroup.POINTERTRACKER_CALLLISTENERONRELEASE_ENABLED) { - final String s = "onRelease : " + Keyboard.printableCode(primaryCode) - + " sliding=" + withSliding + " ignoreModifier=" + ignoreModifierKey - + " enabled="+ key.isEnabled(); - logUnstructured("PointerTracker_callListenerOnRelease", s); - } - } - - public static void pointerTracker_onDownEvent(long deltaT, int distanceSquared) { - if (UnsLogGroup.POINTERTRACKER_ONDOWNEVENT_ENABLED) { - final String s = "onDownEvent: ignore potential noise: time=" + deltaT - + " distance=" + distanceSquared; - logUnstructured("PointerTracker_onDownEvent", s); - } - } - - public static void pointerTracker_onMoveEvent(final int x, final int y, final int lastX, - final int lastY) { - if (UnsLogGroup.POINTERTRACKER_ONMOVEEVENT_ENABLED) { - final String s = String.format("onMoveEvent: sudden move is translated to " - + "up[%d,%d]/down[%d,%d] events", lastX, lastY, x, y); - logUnstructured("PointerTracker_onMoveEvent", s); - } - } - - public static void suddenJumpingTouchEventHandler_onTouchEvent(final MotionEvent me) { - if (UnsLogGroup.SUDDENJUMPINGTOUCHEVENTHANDLER_ONTOUCHEVENT_ENABLED) { - final String s = "onTouchEvent: ignore sudden jump " + me; - logUnstructured("SuddenJumpingTouchEventHandler_onTouchEvent", s); - } - } } |