Merge "Log for geometric input" into jb-mr1-dev
commit
8eb2065289
|
@ -72,6 +72,7 @@ import com.android.inputmethod.keyboard.KeyboardSwitcher;
|
|||
import com.android.inputmethod.keyboard.KeyboardView;
|
||||
import com.android.inputmethod.keyboard.MainKeyboardView;
|
||||
import com.android.inputmethod.latin.LocaleUtils.RunInLocale;
|
||||
import com.android.inputmethod.latin.Utils.Stats;
|
||||
import com.android.inputmethod.latin.define.ProductionFlag;
|
||||
import com.android.inputmethod.latin.suggestions.SuggestionStripView;
|
||||
import com.android.inputmethod.research.ResearchLogger;
|
||||
|
@ -148,7 +149,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
private boolean mIsUserDictionaryAvailable;
|
||||
|
||||
private LastComposedWord mLastComposedWord = LastComposedWord.NOT_A_COMPOSED_WORD;
|
||||
private WordComposer mWordComposer = new WordComposer();
|
||||
private final WordComposer mWordComposer = new WordComposer();
|
||||
private RichInputConnection mConnection = new RichInputConnection(this);
|
||||
|
||||
// Keep track of the last selection range to decide if we need to show word alternatives
|
||||
|
@ -1331,6 +1332,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
didAutoCorrect = handleSeparator(primaryCode, x, y, spaceState);
|
||||
} else {
|
||||
if (SPACE_STATE_PHANTOM == spaceState) {
|
||||
if (ProductionFlag.IS_INTERNAL) {
|
||||
if (mWordComposer.isComposingWord() && mWordComposer.isBatchMode()) {
|
||||
Stats.onAutoCorrection(
|
||||
"", mWordComposer.getTypedWord(), " ", mWordComposer);
|
||||
}
|
||||
}
|
||||
commitTyped(LastComposedWord.NOT_A_SEPARATOR);
|
||||
}
|
||||
final int keyX, keyY;
|
||||
|
@ -1389,6 +1396,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
public void onStartBatchInput() {
|
||||
mConnection.beginBatchEdit();
|
||||
if (mWordComposer.isComposingWord()) {
|
||||
if (ProductionFlag.IS_INTERNAL) {
|
||||
if (mWordComposer.isBatchMode()) {
|
||||
Stats.onAutoCorrection("", mWordComposer.getTypedWord(), " ", mWordComposer);
|
||||
}
|
||||
}
|
||||
commitTyped(LastComposedWord.NOT_A_SEPARATOR);
|
||||
mExpectingUpdateSelection = true;
|
||||
// The following is necessary for the case where the user typed something but didn't
|
||||
|
@ -1547,7 +1559,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
}
|
||||
} else {
|
||||
if (mLastComposedWord.canRevertCommit()) {
|
||||
Utils.Stats.onAutoCorrectionCancellation();
|
||||
if (ProductionFlag.IS_INTERNAL) {
|
||||
Stats.onAutoCorrectionCancellation();
|
||||
}
|
||||
revertCommit();
|
||||
return;
|
||||
}
|
||||
|
@ -1696,8 +1710,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
if (null != mSuggestionStripView) mSuggestionStripView.dismissAddToDictionaryHint();
|
||||
}
|
||||
mHandler.postUpdateSuggestionStrip();
|
||||
if (ProductionFlag.IS_INTERNAL) {
|
||||
Utils.Stats.onNonSeparator((char)primaryCode, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
// Returns true if we did an autocorrection, false otherwise.
|
||||
private boolean handleSeparator(final int primaryCode, final int x, final int y,
|
||||
|
@ -1760,8 +1776,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
// already displayed or not, so it's okay.
|
||||
setPunctuationSuggestions();
|
||||
}
|
||||
|
||||
if (ProductionFlag.IS_INTERNAL) {
|
||||
Utils.Stats.onSeparator((char)primaryCode, x, y);
|
||||
}
|
||||
|
||||
mHandler.postUpdateShiftState();
|
||||
return didAutoCorrect;
|
||||
|
@ -1930,7 +1947,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
throw new RuntimeException("We have an auto-correction but the typed word "
|
||||
+ "is empty? Impossible! I must commit suicide.");
|
||||
}
|
||||
Utils.Stats.onAutoCorrection(typedWord, autoCorrection.toString(), separatorString);
|
||||
if (ProductionFlag.IS_INTERNAL) {
|
||||
Stats.onAutoCorrection(
|
||||
typedWord, autoCorrection.toString(), separatorString, mWordComposer);
|
||||
}
|
||||
mExpectingUpdateSelection = true;
|
||||
commitChosenWord(autoCorrection, LastComposedWord.COMMIT_TYPE_DECIDED_WORD,
|
||||
separatorString);
|
||||
|
@ -2020,8 +2040,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
// If the suggestion is not in the dictionary, the hint should be shown.
|
||||
&& !AutoCorrection.isValidWord(mSuggest.getUnigramDictionaries(), suggestion, true);
|
||||
|
||||
Utils.Stats.onSeparator((char)Keyboard.CODE_SPACE,
|
||||
if (ProductionFlag.IS_INTERNAL) {
|
||||
Stats.onSeparator((char)Keyboard.CODE_SPACE,
|
||||
Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE);
|
||||
}
|
||||
if (showingAddToDictionaryHint && mIsUserDictionaryAvailable) {
|
||||
mSuggestionStripView.showAddToDictionaryHint(
|
||||
suggestion, mCurrentSettings.mHintToSaveText);
|
||||
|
@ -2138,8 +2160,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
previousWord.toString(), committedWord.toString());
|
||||
}
|
||||
mConnection.commitText(originallyTypedWord + mLastComposedWord.mSeparatorString, 1);
|
||||
Utils.Stats.onSeparator(mLastComposedWord.mSeparatorString,
|
||||
if (ProductionFlag.IS_INTERNAL) {
|
||||
Stats.onSeparator(mLastComposedWord.mSeparatorString,
|
||||
Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE);
|
||||
}
|
||||
if (ProductionFlag.IS_EXPERIMENTAL) {
|
||||
ResearchLogger.latinIME_revertCommit(originallyTypedWord);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
|||
}
|
||||
|
||||
public static void logOnAutoCorrectionForGeometric(String before, String after,
|
||||
int separatorCode, int[] xCoordinates, int[] yCoordinates, int[] relativeTimes) {
|
||||
int separatorCode, InputPointers inputPointers) {
|
||||
}
|
||||
|
||||
public static void logOnAutoCorrectionCancelled() {
|
||||
|
|
|
@ -306,6 +306,10 @@ public class Suggest {
|
|||
wordComposer, prevWordForBigram, proximityInfo, sessionId));
|
||||
}
|
||||
|
||||
for (SuggestedWordInfo wordInfo : suggestionsSet) {
|
||||
LatinImeLogger.onAddSuggestedWord(wordInfo.mWord.toString(), wordInfo.mSourceDict);
|
||||
}
|
||||
|
||||
final ArrayList<SuggestedWordInfo> suggestionsContainer =
|
||||
CollectionUtils.newArrayList(suggestionsSet);
|
||||
final int suggestionsCount = suggestionsContainer.size();
|
||||
|
|
|
@ -412,14 +412,24 @@ public final class Utils {
|
|||
}
|
||||
|
||||
public static void onAutoCorrection(final String typedWord, final String correctedWord,
|
||||
final String separatorString) {
|
||||
if (TextUtils.isEmpty(typedWord)) return;
|
||||
final String separatorString, final WordComposer wordComposer) {
|
||||
final boolean isBatchMode = wordComposer.isBatchMode();
|
||||
if (!isBatchMode && TextUtils.isEmpty(typedWord)) return;
|
||||
// TODO: this fails when the separator is more than 1 code point long, but
|
||||
// the backend can't handle it yet. The only case when this happens is with
|
||||
// smileys and other multi-character keys.
|
||||
final int codePoint = TextUtils.isEmpty(separatorString) ? Constants.NOT_A_CODE
|
||||
: separatorString.codePointAt(0);
|
||||
if (!isBatchMode) {
|
||||
LatinImeLogger.logOnAutoCorrectionForTyping(typedWord, correctedWord, codePoint);
|
||||
} else {
|
||||
if (!TextUtils.isEmpty(correctedWord)) {
|
||||
// We must make sure that InputPointer contains only the relative timestamps,
|
||||
// not actual timestamps.
|
||||
LatinImeLogger.logOnAutoCorrectionForGeometric(
|
||||
"", correctedWord, codePoint, wordComposer.getInputPointers());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void onAutoCorrectionCancellation() {
|
||||
|
|
Loading…
Reference in New Issue