Merge "ResearchLogger log RichInputConnection" into jb-mr1-dev

main
Kurt Partridge 2012-08-21 18:18:52 -07:00 committed by Android (Google) Code Review
commit 06cb405713
3 changed files with 189 additions and 184 deletions

View File

@ -907,13 +907,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
} }
} }
} }
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_onDisplayCompletions(applicationSpecifiedCompletions);
}
if (!mCurrentSettings.isApplicationSpecifiedCompletionsOn()) return; if (!mCurrentSettings.isApplicationSpecifiedCompletionsOn()) return;
mApplicationSpecifiedCompletions = applicationSpecifiedCompletions; mApplicationSpecifiedCompletions = applicationSpecifiedCompletions;
if (applicationSpecifiedCompletions == null) { if (applicationSpecifiedCompletions == null) {
clearSuggestionStrip(); clearSuggestionStrip();
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_onDisplayCompletions(null);
}
return; return;
} }
@ -935,6 +935,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// this case? This says to keep whatever the user typed. // this case? This says to keep whatever the user typed.
mWordComposer.setAutoCorrection(mWordComposer.getTypedWord()); mWordComposer.setAutoCorrection(mWordComposer.getTypedWord());
setSuggestionStripShown(true); setSuggestionStripShown(true);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_onDisplayCompletions(applicationSpecifiedCompletions);
}
} }
private void setSuggestionStripShownInternal(boolean shown, boolean needsInputViewShown) { private void setSuggestionStripShownInternal(boolean shown, boolean needsInputViewShown) {
@ -1055,9 +1058,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final CharSequence typedWord = mWordComposer.getTypedWord(); final CharSequence typedWord = mWordComposer.getTypedWord();
if (typedWord.length() > 0) { if (typedWord.length() > 0) {
mConnection.commitText(typedWord, 1); mConnection.commitText(typedWord, 1);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_commitText(typedWord);
}
final CharSequence prevWord = addToUserHistoryDictionary(typedWord); final CharSequence prevWord = addToUserHistoryDictionary(typedWord);
mLastComposedWord = mWordComposer.commitWord( mLastComposedWord = mWordComposer.commitWord(
LastComposedWord.COMMIT_TYPE_USER_TYPED_WORD, typedWord.toString(), LastComposedWord.COMMIT_TYPE_USER_TYPED_WORD, typedWord.toString(),
@ -1111,12 +1111,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (lastTwo != null && lastTwo.length() == 2 if (lastTwo != null && lastTwo.length() == 2
&& lastTwo.charAt(0) == Keyboard.CODE_SPACE) { && lastTwo.charAt(0) == Keyboard.CODE_SPACE) {
mConnection.deleteSurroundingText(2, 0); mConnection.deleteSurroundingText(2, 0);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_deleteSurroundingText(2);
}
mConnection.commitText(lastTwo.charAt(1) + " ", 1); mConnection.commitText(lastTwo.charAt(1) + " ", 1);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_swapSwapperAndSpaceWhileInBatchEdit(); ResearchLogger.latinIME_swapSwapperAndSpace();
} }
mKeyboardSwitcher.updateShiftState(); mKeyboardSwitcher.updateShiftState();
} }
@ -1133,9 +1130,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mHandler.cancelDoubleSpacesTimer(); mHandler.cancelDoubleSpacesTimer();
mConnection.deleteSurroundingText(2, 0); mConnection.deleteSurroundingText(2, 0);
mConnection.commitText(". ", 1); mConnection.commitText(". ", 1);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_doubleSpaceAutoPeriod();
}
mKeyboardSwitcher.updateShiftState(); mKeyboardSwitcher.updateShiftState();
return true; return true;
} }
@ -1199,9 +1193,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private void performEditorAction(int actionId) { private void performEditorAction(int actionId) {
mConnection.performEditorAction(actionId); mConnection.performEditorAction(actionId);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_performEditorAction(actionId);
}
} }
private void handleLanguageSwitchKey() { private void handleLanguageSwitchKey() {
@ -1238,6 +1229,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// For backward compatibility. See {@link InputMethodService#sendKeyChar(char)}. // For backward compatibility. See {@link InputMethodService#sendKeyChar(char)}.
if (code >= '0' && code <= '9') { if (code >= '0' && code <= '9') {
super.sendKeyChar((char)code); super.sendKeyChar((char)code);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_sendKeyCodePoint(code);
}
return; return;
} }
@ -1254,9 +1248,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final String text = new String(new int[] { code }, 0, 1); final String text = new String(new int[] { code }, 0, 1);
mConnection.commitText(text, text.length()); mConnection.commitText(text, text.length());
} }
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_sendKeyCodePoint(code);
}
} }
// Implementation of {@link KeyboardActionListener}. // Implementation of {@link KeyboardActionListener}.
@ -1367,9 +1358,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
sendKeyCodePoint(Keyboard.CODE_SPACE); sendKeyCodePoint(Keyboard.CODE_SPACE);
} }
mConnection.commitText(text, 1); mConnection.commitText(text, 1);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_commitText(text);
}
mConnection.endBatchEdit(); mConnection.endBatchEdit();
mKeyboardSwitcher.updateShiftState(); mKeyboardSwitcher.updateShiftState();
mKeyboardSwitcher.onCodeInput(Keyboard.CODE_OUTPUT_TEXT); mKeyboardSwitcher.onCodeInput(Keyboard.CODE_OUTPUT_TEXT);
@ -1467,9 +1455,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// like the smiley key or the .com key. // like the smiley key or the .com key.
final int length = mEnteredText.length(); final int length = mEnteredText.length();
mConnection.deleteSurroundingText(length, 0); mConnection.deleteSurroundingText(length, 0);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_deleteSurroundingText(length);
}
// If we have mEnteredText, then we know that mHasUncommittedTypedChars == false. // If we have mEnteredText, then we know that mHasUncommittedTypedChars == false.
// In addition we know that spaceState is false, and that we should not be // In addition we know that spaceState is false, and that we should not be
// reverting any autocorrect at this point. So we can safely return. // reverting any autocorrect at this point. So we can safely return.
@ -1489,9 +1474,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mHandler.postUpdateSuggestionStrip(); mHandler.postUpdateSuggestionStrip();
} else { } else {
mConnection.deleteSurroundingText(1, 0); mConnection.deleteSurroundingText(1, 0);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_deleteSurroundingText(1);
}
} }
} else { } else {
if (mLastComposedWord.canRevertCommit()) { if (mLastComposedWord.canRevertCommit()) {
@ -1520,9 +1502,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final int lengthToDelete = mLastSelectionEnd - mLastSelectionStart; final int lengthToDelete = mLastSelectionEnd - mLastSelectionStart;
mConnection.setSelection(mLastSelectionEnd, mLastSelectionEnd); mConnection.setSelection(mLastSelectionEnd, mLastSelectionEnd);
mConnection.deleteSurroundingText(lengthToDelete, 0); mConnection.deleteSurroundingText(lengthToDelete, 0);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_deleteSurroundingText(lengthToDelete);
}
} else { } else {
// There is no selection, just delete one character. // There is no selection, just delete one character.
if (NOT_A_CURSOR_POSITION == mLastSelectionEnd) { if (NOT_A_CURSOR_POSITION == mLastSelectionEnd) {
@ -1541,14 +1520,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
} else { } else {
mConnection.deleteSurroundingText(1, 0); mConnection.deleteSurroundingText(1, 0);
} }
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_deleteSurroundingText(1);
}
if (mDeleteCount > DELETE_ACCELERATE_AT) { if (mDeleteCount > DELETE_ACCELERATE_AT) {
mConnection.deleteSurroundingText(1, 0); mConnection.deleteSurroundingText(1, 0);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_deleteSurroundingText(1);
}
} }
} }
if (mCurrentSettings.isSuggestionsRequested(mDisplayOrientation)) { if (mCurrentSettings.isSuggestionsRequested(mDisplayOrientation)) {
@ -1873,10 +1846,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
+ "is empty? Impossible! I must commit suicide."); + "is empty? Impossible! I must commit suicide.");
} }
Utils.Stats.onAutoCorrection(typedWord, autoCorrection.toString(), separatorCodePoint); Utils.Stats.onAutoCorrection(typedWord, autoCorrection.toString(), separatorCodePoint);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_commitCurrentAutoCorrection(typedWord,
autoCorrection.toString());
}
mExpectingUpdateSelection = true; mExpectingUpdateSelection = true;
commitChosenWord(autoCorrection, LastComposedWord.COMMIT_TYPE_DECIDED_WORD, commitChosenWord(autoCorrection, LastComposedWord.COMMIT_TYPE_DECIDED_WORD,
separatorCodePoint); separatorCodePoint);
@ -1901,12 +1870,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// So, LatinImeLogger logs "" as a user's input. // So, LatinImeLogger logs "" as a user's input.
LatinImeLogger.logOnManualSuggestion("", suggestion.toString(), index, suggestedWords); LatinImeLogger.logOnManualSuggestion("", suggestion.toString(), index, suggestedWords);
// Rely on onCodeInput to do the complicated swapping/stripping logic consistently. // Rely on onCodeInput to do the complicated swapping/stripping logic consistently.
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_punctuationSuggestion(index, suggestion);
}
final int primaryCode = suggestion.charAt(0); final int primaryCode = suggestion.charAt(0);
onCodeInput(primaryCode, onCodeInput(primaryCode,
Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE); Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_punctuationSuggestion(index, suggestion);
}
return; return;
} }
@ -1933,10 +1902,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final CompletionInfo completionInfo = mApplicationSpecifiedCompletions[index]; final CompletionInfo completionInfo = mApplicationSpecifiedCompletions[index];
mConnection.commitCompletion(completionInfo); mConnection.commitCompletion(completionInfo);
mConnection.endBatchEdit(); mConnection.endBatchEdit();
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_pickApplicationSpecifiedCompletion(
index, completionInfo.getText());
}
return; return;
} }
@ -1945,12 +1910,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final String replacedWord = mWordComposer.getTypedWord().toString(); final String replacedWord = mWordComposer.getTypedWord().toString();
LatinImeLogger.logOnManualSuggestion(replacedWord, LatinImeLogger.logOnManualSuggestion(replacedWord,
suggestion.toString(), index, suggestedWords); suggestion.toString(), index, suggestedWords);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_pickSuggestionManually(replacedWord, index, suggestion);
}
mExpectingUpdateSelection = true; mExpectingUpdateSelection = true;
commitChosenWord(suggestion, LastComposedWord.COMMIT_TYPE_MANUAL_PICK, commitChosenWord(suggestion, LastComposedWord.COMMIT_TYPE_MANUAL_PICK,
LastComposedWord.NOT_A_SEPARATOR); LastComposedWord.NOT_A_SEPARATOR);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_pickSuggestionManually(replacedWord, index, suggestion);
}
mConnection.endBatchEdit(); mConnection.endBatchEdit();
// Don't allow cancellation of manual pick // Don't allow cancellation of manual pick
mLastComposedWord.deactivate(); mLastComposedWord.deactivate();
@ -1985,9 +1950,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final SuggestedWords suggestedWords = mSuggestionStripView.getSuggestions(); final SuggestedWords suggestedWords = mSuggestionStripView.getSuggestions();
mConnection.commitText(SuggestionSpanUtils.getTextWithSuggestionSpan( mConnection.commitText(SuggestionSpanUtils.getTextWithSuggestionSpan(
this, chosenWord, suggestedWords, mIsMainDictionaryAvailable), 1); this, chosenWord, suggestedWords, mIsMainDictionaryAvailable), 1);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_commitText(chosenWord);
}
// Add the word to the user history dictionary // Add the word to the user history dictionary
final CharSequence prevWord = addToUserHistoryDictionary(chosenWord); final CharSequence prevWord = addToUserHistoryDictionary(chosenWord);
// TODO: figure out here if this is an auto-correct or if the best word is actually // TODO: figure out here if this is an auto-correct or if the best word is actually
@ -2055,9 +2017,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mWordComposer.setComposingWord(word, mKeyboardSwitcher.getKeyboard()); mWordComposer.setComposingWord(word, mKeyboardSwitcher.getKeyboard());
final int length = word.length(); final int length = word.length();
mConnection.deleteSurroundingText(length, 0); mConnection.deleteSurroundingText(length, 0);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_deleteSurroundingText(length);
}
mConnection.setComposingText(word, 1); mConnection.setComposingText(word, 1);
mHandler.postUpdateSuggestionStrip(); mHandler.postUpdateSuggestionStrip();
} }
@ -2085,9 +2044,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
} }
} }
mConnection.deleteSurroundingText(deleteLength, 0); mConnection.deleteSurroundingText(deleteLength, 0);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_deleteSurroundingText(deleteLength);
}
if (!TextUtils.isEmpty(previousWord) && !TextUtils.isEmpty(committedWord)) { if (!TextUtils.isEmpty(previousWord) && !TextUtils.isEmpty(committedWord)) {
mUserHistoryDictionary.cancelAddingUserHistory( mUserHistoryDictionary.cancelAddingUserHistory(
previousWord.toString(), committedWord.toString()); previousWord.toString(), committedWord.toString());

View File

@ -55,7 +55,9 @@ public class RichInputConnection {
public void beginBatchEdit() { public void beginBatchEdit() {
if (++mNestLevel == 1) { if (++mNestLevel == 1) {
mIC = mParent.getCurrentInputConnection(); mIC = mParent.getCurrentInputConnection();
if (null != mIC) mIC.beginBatchEdit(); if (null != mIC) {
mIC.beginBatchEdit();
}
} else { } else {
if (DBG) { if (DBG) {
throw new RuntimeException("Nest level too deep"); throw new RuntimeException("Nest level too deep");
@ -66,7 +68,9 @@ public class RichInputConnection {
} }
public void endBatchEdit() { public void endBatchEdit() {
if (mNestLevel <= 0) Log.e(TAG, "Batch edit not in progress!"); // TODO: exception instead if (mNestLevel <= 0) Log.e(TAG, "Batch edit not in progress!"); // TODO: exception instead
if (--mNestLevel == 0 && null != mIC) mIC.endBatchEdit(); if (--mNestLevel == 0 && null != mIC) {
mIC.endBatchEdit();
}
} }
private void checkBatchEdit() { private void checkBatchEdit() {
@ -79,12 +83,22 @@ public class RichInputConnection {
public void finishComposingText() { public void finishComposingText() {
checkBatchEdit(); checkBatchEdit();
if (null != mIC) mIC.finishComposingText(); if (null != mIC) {
mIC.finishComposingText();
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.richInputConnection_finishComposingText();
}
}
} }
public void commitText(final CharSequence text, final int i) { public void commitText(final CharSequence text, final int i) {
checkBatchEdit(); checkBatchEdit();
if (null != mIC) mIC.commitText(text, i); if (null != mIC) {
mIC.commitText(text, i);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.richInputConnection_commitText(text, i);
}
}
} }
public int getCursorCapsMode(final int inputType) { public int getCursorCapsMode(final int inputType) {
@ -107,37 +121,72 @@ public class RichInputConnection {
public void deleteSurroundingText(final int i, final int j) { public void deleteSurroundingText(final int i, final int j) {
checkBatchEdit(); checkBatchEdit();
if (null != mIC) mIC.deleteSurroundingText(i, j); if (null != mIC) {
mIC.deleteSurroundingText(i, j);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.richInputConnection_deleteSurroundingText(i, j);
}
}
} }
public void performEditorAction(final int actionId) { public void performEditorAction(final int actionId) {
mIC = mParent.getCurrentInputConnection(); mIC = mParent.getCurrentInputConnection();
if (null != mIC) mIC.performEditorAction(actionId); if (null != mIC) {
mIC.performEditorAction(actionId);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.richInputConnection_performEditorAction(actionId);
}
}
} }
public void sendKeyEvent(final KeyEvent keyEvent) { public void sendKeyEvent(final KeyEvent keyEvent) {
checkBatchEdit(); checkBatchEdit();
if (null != mIC) mIC.sendKeyEvent(keyEvent); if (null != mIC) {
mIC.sendKeyEvent(keyEvent);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.richInputConnection_sendKeyEvent(keyEvent);
}
}
} }
public void setComposingText(final CharSequence text, final int i) { public void setComposingText(final CharSequence text, final int i) {
checkBatchEdit(); checkBatchEdit();
if (null != mIC) mIC.setComposingText(text, i); if (null != mIC) {
mIC.setComposingText(text, i);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.richInputConnection_setComposingText(text, i);
}
}
} }
public void setSelection(final int from, final int to) { public void setSelection(final int from, final int to) {
checkBatchEdit(); checkBatchEdit();
if (null != mIC) mIC.setSelection(from, to); if (null != mIC) {
mIC.setSelection(from, to);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.richInputConnection_setSelection(from, to);
}
}
} }
public void commitCorrection(final CorrectionInfo correctionInfo) { public void commitCorrection(final CorrectionInfo correctionInfo) {
checkBatchEdit(); checkBatchEdit();
if (null != mIC) mIC.commitCorrection(correctionInfo); if (null != mIC) {
mIC.commitCorrection(correctionInfo);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.richInputConnection_commitCorrection(correctionInfo);
}
}
} }
public void commitCompletion(final CompletionInfo completionInfo) { public void commitCompletion(final CompletionInfo completionInfo) {
checkBatchEdit(); checkBatchEdit();
if (null != mIC) mIC.commitCompletion(completionInfo); if (null != mIC) {
mIC.commitCompletion(completionInfo);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.richInputConnection_commitCompletion(completionInfo);
}
}
} }
public CharSequence getNthPreviousWord(final String sentenceSeperators, final int n) { public CharSequence getNthPreviousWord(final String sentenceSeperators, final int n) {
@ -315,9 +364,6 @@ public class RichInputConnection {
if (lastOne != null && lastOne.length() == 1 if (lastOne != null && lastOne.length() == 1
&& lastOne.charAt(0) == Keyboard.CODE_SPACE) { && lastOne.charAt(0) == Keyboard.CODE_SPACE) {
deleteSurroundingText(1, 0); deleteSurroundingText(1, 0);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_deleteSurroundingText(1);
}
} }
} }
@ -382,13 +428,7 @@ public class RichInputConnection {
return false; return false;
} }
deleteSurroundingText(2, 0); deleteSurroundingText(2, 0);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_deleteSurroundingText(2);
}
commitText(" ", 1); commitText(" ", 1);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_revertDoubleSpaceWhileInBatchEdit();
}
return true; return true;
} }
@ -409,13 +449,7 @@ public class RichInputConnection {
return false; return false;
} }
deleteSurroundingText(2, 0); deleteSurroundingText(2, 0);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_deleteSurroundingText(2);
}
commitText(" " + textBeforeCursor.subSequence(0, 1), 1); commitText(" " + textBeforeCursor.subSequence(0, 1), 1);
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_revertSwapPunctuation();
}
return true; return true;
} }
} }

View File

@ -37,12 +37,14 @@ import android.os.IBinder;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.inputmethod.CompletionInfo; import android.view.inputmethod.CompletionInfo;
import android.view.inputmethod.CorrectionInfo;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputConnection;
import android.widget.Button; import android.widget.Button;
@ -847,20 +849,6 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
stop(); stop();
} }
private static final String[] EVENTKEYS_LATINIME_COMMITTEXT = {
"LatinIMECommitText", "typedWord"
};
public static void latinIME_commitText(final CharSequence typedWord) {
final String scrubbedWord = scrubDigitsFromString(typedWord.toString());
final Object[] values = {
scrubbedWord
};
final ResearchLogger researchLogger = getInstance();
researchLogger.enqueuePotentiallyPrivateEvent(EVENTKEYS_LATINIME_COMMITTEXT, values);
researchLogger.onWordComplete(scrubbedWord);
}
private static final String[] EVENTKEYS_USER_FEEDBACK = { private static final String[] EVENTKEYS_USER_FEEDBACK = {
"UserFeedback", "FeedbackContents" "UserFeedback", "FeedbackContents"
}; };
@ -915,47 +903,6 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
getInstance().enqueuePotentiallyPrivateEvent(EVENTKEYS_LATINIME_ONCODEINPUT, values); getInstance().enqueuePotentiallyPrivateEvent(EVENTKEYS_LATINIME_ONCODEINPUT, values);
} }
private static final String[] EVENTKEYS_CORRECTION = {
"LogCorrection", "subgroup", "before", "after", "position"
};
public static void logCorrection(final String subgroup, final String before, final String after,
final int position) {
final Object[] values = {
subgroup, scrubDigitsFromString(before), scrubDigitsFromString(after), position
};
getInstance().enqueuePotentiallyPrivateEvent(EVENTKEYS_CORRECTION, values);
}
private static final String[] EVENTKEYS_LATINIME_COMMITCURRENTAUTOCORRECTION = {
"LatinIMECommitCurrentAutoCorrection", "typedWord", "autoCorrection"
};
public static void latinIME_commitCurrentAutoCorrection(final String typedWord,
final String autoCorrection) {
final Object[] values = {
scrubDigitsFromString(typedWord), scrubDigitsFromString(autoCorrection)
};
final ResearchLogger researchLogger = getInstance();
researchLogger.enqueuePotentiallyPrivateEvent(
EVENTKEYS_LATINIME_COMMITCURRENTAUTOCORRECTION, values);
}
private static final String[] EVENTKEYS_LATINIME_DELETESURROUNDINGTEXT = {
"LatinIMEDeleteSurroundingText", "length"
};
public static void latinIME_deleteSurroundingText(final int length) {
final Object[] values = {
length
};
getInstance().enqueueEvent(EVENTKEYS_LATINIME_DELETESURROUNDINGTEXT, values);
}
private static final String[] EVENTKEYS_LATINIME_DOUBLESPACEAUTOPERIOD = {
"LatinIMEDoubleSpaceAutoPeriod"
};
public static void latinIME_doubleSpaceAutoPeriod() {
getInstance().enqueueEvent(EVENTKEYS_LATINIME_DOUBLESPACEAUTOPERIOD, EVENTKEYS_NULLVALUES);
}
private static final String[] EVENTKEYS_LATINIME_ONDISPLAYCOMPLETIONS = { private static final String[] EVENTKEYS_LATINIME_ONDISPLAYCOMPLETIONS = {
"LatinIMEOnDisplayCompletions", "applicationSpecifiedCompletions" "LatinIMEOnDisplayCompletions", "applicationSpecifiedCompletions"
}; };
@ -980,6 +927,10 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
public static void latinIME_onWindowHidden(final int savedSelectionStart, public static void latinIME_onWindowHidden(final int savedSelectionStart,
final int savedSelectionEnd, final InputConnection ic) { final int savedSelectionEnd, final InputConnection ic) {
if (ic != null) { if (ic != null) {
// Capture the TextView contents. This will trigger onUpdateSelection(), so we
// set sLatinIMEExpectingUpdateSelection so that when onUpdateSelection() is called,
// it can tell that it was generated by the logging code, and not by the user, and
// therefore keep user-visible state as is.
ic.beginBatchEdit(); ic.beginBatchEdit();
ic.performContextMenuAction(android.R.id.selectAll); ic.performContextMenuAction(android.R.id.selectAll);
CharSequence charSequence = ic.getSelectedText(0); CharSequence charSequence = ic.getSelectedText(0);
@ -1049,29 +1000,6 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
researchLogger.enqueuePotentiallyPrivateEvent(EVENTKEYS_LATINIME_ONUPDATESELECTION, values); researchLogger.enqueuePotentiallyPrivateEvent(EVENTKEYS_LATINIME_ONUPDATESELECTION, values);
} }
private static final String[] EVENTKEYS_LATINIME_PERFORMEDITORACTION = {
"LatinIMEPerformEditorAction", "imeActionNext"
};
public static void latinIME_performEditorAction(final int imeActionNext) {
final Object[] values = {
imeActionNext
};
getInstance().enqueueEvent(EVENTKEYS_LATINIME_PERFORMEDITORACTION, values);
}
private static final String[] EVENTKEYS_LATINIME_PICKAPPLICATIONSPECIFIEDCOMPLETION = {
"LatinIMEPickApplicationSpecifiedCompletion", "index", "text", "x", "y"
};
public static void latinIME_pickApplicationSpecifiedCompletion(final int index,
final CharSequence cs) {
final Object[] values = {
index, cs, Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE
};
final ResearchLogger researchLogger = getInstance();
researchLogger.enqueuePotentiallyPrivateEvent(
EVENTKEYS_LATINIME_PICKAPPLICATIONSPECIFIEDCOMPLETION, values);
}
private static final String[] EVENTKEYS_LATINIME_PICKSUGGESTIONMANUALLY = { private static final String[] EVENTKEYS_LATINIME_PICKSUGGESTIONMANUALLY = {
"LatinIMEPickSuggestionManually", "replacedWord", "index", "suggestion", "x", "y" "LatinIMEPickSuggestionManually", "replacedWord", "index", "suggestion", "x", "y"
}; };
@ -1099,21 +1027,6 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
getInstance().enqueueEvent(EVENTKEYS_LATINIME_PUNCTUATIONSUGGESTION, values); getInstance().enqueueEvent(EVENTKEYS_LATINIME_PUNCTUATIONSUGGESTION, values);
} }
private static final String[] EVENTKEYS_LATINIME_REVERTDOUBLESPACEWHILEINBATCHEDIT = {
"LatinIMERevertDoubleSpaceWhileInBatchEdit"
};
public static void latinIME_revertDoubleSpaceWhileInBatchEdit() {
getInstance().enqueueEvent(EVENTKEYS_LATINIME_REVERTDOUBLESPACEWHILEINBATCHEDIT,
EVENTKEYS_NULLVALUES);
}
private static final String[] EVENTKEYS_LATINIME_REVERTSWAPPUNCTUATION = {
"LatinIMERevertSwapPunctuation"
};
public static void latinIME_revertSwapPunctuation() {
getInstance().enqueueEvent(EVENTKEYS_LATINIME_REVERTSWAPPUNCTUATION, EVENTKEYS_NULLVALUES);
}
private static final String[] EVENTKEYS_LATINIME_SENDKEYCODEPOINT = { private static final String[] EVENTKEYS_LATINIME_SENDKEYCODEPOINT = {
"LatinIMESendKeyCodePoint", "code" "LatinIMESendKeyCodePoint", "code"
}; };
@ -1124,12 +1037,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
getInstance().enqueuePotentiallyPrivateEvent(EVENTKEYS_LATINIME_SENDKEYCODEPOINT, values); getInstance().enqueuePotentiallyPrivateEvent(EVENTKEYS_LATINIME_SENDKEYCODEPOINT, values);
} }
private static final String[] EVENTKEYS_LATINIME_SWAPSWAPPERANDSPACEWHILEINBATCHEDIT = { private static final String[] EVENTKEYS_LATINIME_SWAPSWAPPERANDSPACE = {
"LatinIMESwapSwapperAndSpaceWhileInBatchEdit" "LatinIMESwapSwapperAndSpace"
}; };
public static void latinIME_swapSwapperAndSpaceWhileInBatchEdit() { public static void latinIME_swapSwapperAndSpace() {
getInstance().enqueueEvent(EVENTKEYS_LATINIME_SWAPSWAPPERANDSPACEWHILEINBATCHEDIT, getInstance().enqueueEvent(EVENTKEYS_LATINIME_SWAPSWAPPERANDSPACE, EVENTKEYS_NULLVALUES);
EVENTKEYS_NULLVALUES);
} }
private static final String[] EVENTKEYS_MAINKEYBOARDVIEW_ONLONGPRESS = { private static final String[] EVENTKEYS_MAINKEYBOARDVIEW_ONLONGPRESS = {
@ -1248,6 +1160,109 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
getInstance().enqueuePotentiallyPrivateEvent(EVENTKEYS_POINTERTRACKER_ONMOVEEVENT, values); getInstance().enqueuePotentiallyPrivateEvent(EVENTKEYS_POINTERTRACKER_ONMOVEEVENT, values);
} }
private static final String[] EVENTKEYS_RICHINPUTCONNECTION_COMMITCOMPLETION = {
"RichInputConnectionCommitCompletion", "completionInfo"
};
public static void richInputConnection_commitCompletion(final CompletionInfo completionInfo) {
final Object[] values = {
completionInfo
};
final ResearchLogger researchLogger = getInstance();
researchLogger.enqueuePotentiallyPrivateEvent(
EVENTKEYS_RICHINPUTCONNECTION_COMMITCOMPLETION, values);
}
private static final String[] EVENTKEYS_RICHINPUTCONNECTION_COMMITCORRECTION = {
"RichInputConnectionCommitCorrection", "CorrectionInfo"
};
public static void richInputConnection_commitCorrection(CorrectionInfo correctionInfo) {
final String typedWord = correctionInfo.getOldText().toString();
final String autoCorrection = correctionInfo.getNewText().toString();
final Object[] values = {
scrubDigitsFromString(typedWord), scrubDigitsFromString(autoCorrection)
};
final ResearchLogger researchLogger = getInstance();
researchLogger.enqueuePotentiallyPrivateEvent(
EVENTKEYS_RICHINPUTCONNECTION_COMMITCORRECTION, values);
}
private static final String[] EVENTKEYS_RICHINPUTCONNECTION_COMMITTEXT = {
"RichInputConnectionCommitText", "typedWord", "newCursorPosition"
};
public static void richInputConnection_commitText(final CharSequence typedWord,
final int newCursorPosition) {
final String scrubbedWord = scrubDigitsFromString(typedWord.toString());
final Object[] values = {
scrubbedWord, newCursorPosition
};
final ResearchLogger researchLogger = getInstance();
researchLogger.enqueuePotentiallyPrivateEvent(EVENTKEYS_RICHINPUTCONNECTION_COMMITTEXT,
values);
researchLogger.onWordComplete(scrubbedWord);
}
private static final String[] EVENTKEYS_RICHINPUTCONNECTION_DELETESURROUNDINGTEXT = {
"RichInputConnectionDeleteSurroundingText", "beforeLength", "afterLength"
};
public static void richInputConnection_deleteSurroundingText(final int beforeLength,
final int afterLength) {
final Object[] values = {
beforeLength, afterLength
};
getInstance().enqueueEvent(EVENTKEYS_RICHINPUTCONNECTION_DELETESURROUNDINGTEXT, values);
}
private static final String[] EVENTKEYS_RICHINPUTCONNECTION_FINISHCOMPOSINGTEXT = {
"RichInputConnectionFinishComposingText"
};
public static void richInputConnection_finishComposingText() {
getInstance().enqueueEvent(EVENTKEYS_RICHINPUTCONNECTION_FINISHCOMPOSINGTEXT,
EVENTKEYS_NULLVALUES);
}
private static final String[] EVENTKEYS_RICHINPUTCONNECTION_PERFORMEDITORACTION = {
"RichInputConnectionPerformEditorAction", "imeActionNext"
};
public static void richInputConnection_performEditorAction(final int imeActionNext) {
final Object[] values = {
imeActionNext
};
getInstance().enqueueEvent(EVENTKEYS_RICHINPUTCONNECTION_PERFORMEDITORACTION, values);
}
private static final String[] EVENTKEYS_RICHINPUTCONNECTION_SENDKEYEVENT = {
"RichInputConnectionSendKeyEvent", "eventTime", "action", "code"
};
public static void richInputConnection_sendKeyEvent(final KeyEvent keyEvent) {
final Object[] values = {
keyEvent.getEventTime(),
keyEvent.getAction(),
keyEvent.getKeyCode()
};
getInstance().enqueueEvent(EVENTKEYS_RICHINPUTCONNECTION_SENDKEYEVENT, values);
}
private static final String[] EVENTKEYS_RICHINPUTCONNECTION_SETCOMPOSINGTEXT = {
"RichInputConnectionSetComposingText", "text", "newCursorPosition"
};
public static void richInputConnection_setComposingText(final CharSequence text,
final int newCursorPosition) {
final Object[] values = {
text, newCursorPosition
};
getInstance().enqueueEvent(EVENTKEYS_RICHINPUTCONNECTION_SETCOMPOSINGTEXT, values);
}
private static final String[] EVENTKEYS_RICHINPUTCONNECTION_SETSELECTION = {
"RichInputConnectionSetSelection", "from", "to"
};
public static void richInputConnection_setSelection(final int from, final int to) {
final Object[] values = {
from, to
};
getInstance().enqueueEvent(EVENTKEYS_RICHINPUTCONNECTION_SETSELECTION, values);
}
private static final String[] EVENTKEYS_SUDDENJUMPINGTOUCHEVENTHANDLER_ONTOUCHEVENT = { private static final String[] EVENTKEYS_SUDDENJUMPINGTOUCHEVENTHANDLER_ONTOUCHEVENT = {
"SuddenJumpingTouchEventHandlerOnTouchEvent", "motionEvent" "SuddenJumpingTouchEventHandlerOnTouchEvent", "motionEvent"
}; };