diff options
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index df733c55a..4a3511472 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1301,13 +1301,13 @@ public final class LatinIME extends InputMethodService implements KeyboardAction } private void sendKeyCodePoint(final int code) { + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.latinIME_sendKeyCodePoint(code); + } // TODO: Remove this special handling of digit letters. // For backward compatibility. See {@link InputMethodService#sendKeyChar(char)}. if (code >= '0' && code <= '9') { sendDownUpKeyEventForBackwardCompatibility(code - '0' + KeyEvent.KEYCODE_0); - if (ProductionFlag.IS_EXPERIMENTAL) { - ResearchLogger.latinIME_sendKeyCodePoint(code); - } return; } @@ -1327,6 +1327,9 @@ public final class LatinIME extends InputMethodService implements KeyboardAction // Implementation of {@link KeyboardActionListener}. @Override public void onCodeInput(final int primaryCode, final int x, final int y) { + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.latinIME_onCodeInput(primaryCode, x, y); + } final long when = SystemClock.uptimeMillis(); if (primaryCode != Constants.CODE_DELETE || when > mLastKeyTime + QUICK_PRESS) { mDeleteCount = 0; @@ -1420,9 +1423,6 @@ public final class LatinIME extends InputMethodService implements KeyboardAction mEnteredText = null; } mConnection.endBatchEdit(); - if (ProductionFlag.IS_EXPERIMENTAL) { - ResearchLogger.latinIME_onCodeInput(primaryCode, x, y); - } } // Called from PointerTracker through the KeyboardActionListener interface @@ -1667,7 +1667,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction if (mWordComposer.isBatchMode()) { if (ProductionFlag.IS_EXPERIMENTAL) { final String word = mWordComposer.getTypedWord(); - ResearchLogger.latinIME_handleBackspace_batch(word); + ResearchLogger.latinIME_handleBackspace_batch(word, 1); ResearchLogger.getInstance().uncommitCurrentLogUnit( word, false /* dumpCurrentLogUnit */); } @@ -1718,14 +1718,17 @@ public final class LatinIME extends InputMethodService implements KeyboardAction // We should backspace one char and restart suggestion if at the end of a word. if (mLastSelectionStart != mLastSelectionEnd) { // If there is a selection, remove it. - final int lengthToDelete = mLastSelectionEnd - mLastSelectionStart; + final int numCharsDeleted = mLastSelectionEnd - mLastSelectionStart; mConnection.setSelection(mLastSelectionEnd, mLastSelectionEnd); // Reset mLastSelectionEnd to mLastSelectionStart. This is what is supposed to // happen, and if it's wrong, the next call to onUpdateSelection will correct it, // but we want to set it right away to avoid it being used with the wrong values // later (typically, in a subsequent press on backspace). mLastSelectionEnd = mLastSelectionStart; - mConnection.deleteSurroundingText(lengthToDelete, 0); + mConnection.deleteSurroundingText(numCharsDeleted, 0); + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.latinIME_handleBackspace(numCharsDeleted); + } } else { // There is no selection, just delete one character. if (NOT_A_CURSOR_POSITION == mLastSelectionEnd) { @@ -1742,8 +1745,14 @@ public final class LatinIME extends InputMethodService implements KeyboardAction } else { mConnection.deleteSurroundingText(1, 0); } + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.latinIME_handleBackspace(1); + } if (mDeleteCount > DELETE_ACCELERATE_AT) { mConnection.deleteSurroundingText(1, 0); + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.latinIME_handleBackspace(1); + } } } if (mSettings.getCurrent().isSuggestionsRequested(mDisplayOrientation)) { @@ -1843,6 +1852,9 @@ public final class LatinIME extends InputMethodService implements KeyboardAction // Returns true if we did an autocorrection, false otherwise. private boolean handleSeparator(final int primaryCode, final int x, final int y, final int spaceState) { + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.latinIME_handleSeparator(); + } boolean didAutoCorrect = false; // Handle separator if (mWordComposer.isComposingWord()) { @@ -2122,7 +2134,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE); if (ProductionFlag.IS_EXPERIMENTAL) { ResearchLogger.latinIME_punctuationSuggestion(index, suggestion, - false /* isBatchMode */); + false /* isBatchMode */, suggestedWords.mIsPrediction); } return; } @@ -2309,7 +2321,9 @@ public final class LatinIME extends InputMethodService implements KeyboardAction } if (ProductionFlag.IS_EXPERIMENTAL) { ResearchLogger.latinIME_revertCommit(committedWord, originallyTypedWord, - mWordComposer.isBatchMode()); + mWordComposer.isBatchMode(), mLastComposedWord.mSeparatorString); + ResearchLogger.getInstance().uncommitCurrentLogUnit(committedWord, + true /* dumpCurrentLogUnit */); } // Don't restart suggestion yet. We'll restart if the user deletes the // separator. @@ -2322,6 +2336,9 @@ public final class LatinIME extends InputMethodService implements KeyboardAction public void promotePhantomSpace() { if (mSettings.getCurrent().shouldInsertSpacesAutomatically()) { sendKeyCodePoint(Constants.CODE_SPACE); + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.latinIME_promotePhantomSpace(); + } } } |