Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 14718ab8 authored by Kurt Partridge's avatar Kurt Partridge Committed by Android (Google) Code Review
Browse files

Merge "Log score, kind, and sourceDict for manual suggestion and gesture"

parents 0052dbda fc98325c
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -2357,7 +2357,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
                LastComposedWord.NOT_A_SEPARATOR);
                LastComposedWord.NOT_A_SEPARATOR);
        if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
        if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
            ResearchLogger.latinIME_pickSuggestionManually(replacedWord, index, suggestion,
            ResearchLogger.latinIME_pickSuggestionManually(replacedWord, index, suggestion,
                    mWordComposer.isBatchMode());
                    mWordComposer.isBatchMode(), suggestionInfo.mScore, suggestionInfo.mKind,
                    suggestionInfo.mSourceDict);
        }
        }
        mConnection.endBatchEdit();
        mConnection.endBatchEdit();
        // Don't allow cancellation of manual pick
        // Don't allow cancellation of manual pick
+7 −2
Original line number Original line Diff line number Diff line
@@ -94,12 +94,17 @@ import java.util.Map;
                .value(words.mIsPunctuationSuggestions);
                .value(words.mIsPunctuationSuggestions);
        jsonWriter.name("isObsoleteSuggestions").value(words.mIsObsoleteSuggestions);
        jsonWriter.name("isObsoleteSuggestions").value(words.mIsObsoleteSuggestions);
        jsonWriter.name("isPrediction").value(words.mIsPrediction);
        jsonWriter.name("isPrediction").value(words.mIsPrediction);
        jsonWriter.name("words");
        jsonWriter.name("suggestedWords");
        jsonWriter.beginArray();
        jsonWriter.beginArray();
        final int size = words.size();
        final int size = words.size();
        for (int j = 0; j < size; j++) {
        for (int j = 0; j < size; j++) {
            final SuggestedWordInfo wordInfo = words.getInfo(j);
            final SuggestedWordInfo wordInfo = words.getInfo(j);
            jsonWriter.value(wordInfo.toString());
            jsonWriter.beginObject();
            jsonWriter.name("word").value(wordInfo.toString());
            jsonWriter.name("score").value(wordInfo.mScore);
            jsonWriter.name("kind").value(wordInfo.mKind);
            jsonWriter.name("sourceDict").value(wordInfo.mSourceDict);
            jsonWriter.endObject();
        }
        }
        jsonWriter.endArray();
        jsonWriter.endArray();
        jsonWriter.endObject();
        jsonWriter.endObject();
+6 −5
Original line number Original line Diff line number Diff line
@@ -1308,9 +1308,10 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
     */
     */
    private static final LogStatement LOGSTATEMENT_LATINIME_PICKSUGGESTIONMANUALLY =
    private static final LogStatement LOGSTATEMENT_LATINIME_PICKSUGGESTIONMANUALLY =
            new LogStatement("LatinIMEPickSuggestionManually", true, false, "replacedWord", "index",
            new LogStatement("LatinIMEPickSuggestionManually", true, false, "replacedWord", "index",
                    "suggestion", "x", "y", "isBatchMode");
                    "suggestion", "x", "y", "isBatchMode", "score", "kind", "sourceDict");
    public static void latinIME_pickSuggestionManually(final String replacedWord,
    public static void latinIME_pickSuggestionManually(final String replacedWord,
            final int index, final String suggestion, final boolean isBatchMode) {
            final int index, final String suggestion, final boolean isBatchMode,
            final int score, final int kind, final String sourceDict) {
        final ResearchLogger researchLogger = getInstance();
        final ResearchLogger researchLogger = getInstance();
        if (!replacedWord.equals(suggestion.toString())) {
        if (!replacedWord.equals(suggestion.toString())) {
            // The user chose something other than what was already there.
            // The user chose something other than what was already there.
@@ -1321,7 +1322,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
        researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_PICKSUGGESTIONMANUALLY,
        researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_PICKSUGGESTIONMANUALLY,
                scrubDigitsFromString(replacedWord), index,
                scrubDigitsFromString(replacedWord), index,
                suggestion == null ? null : scrubbedWord, Constants.SUGGESTION_STRIP_COORDINATE,
                suggestion == null ? null : scrubbedWord, Constants.SUGGESTION_STRIP_COORDINATE,
                Constants.SUGGESTION_STRIP_COORDINATE, isBatchMode);
                Constants.SUGGESTION_STRIP_COORDINATE, isBatchMode, score, kind, sourceDict);
        researchLogger.commitCurrentLogUnitAsWord(scrubbedWord, Long.MAX_VALUE, isBatchMode);
        researchLogger.commitCurrentLogUnitAsWord(scrubbedWord, Long.MAX_VALUE, isBatchMode);
        researchLogger.mStatistics.recordManualSuggestion(SystemClock.uptimeMillis());
        researchLogger.mStatistics.recordManualSuggestion(SystemClock.uptimeMillis());
    }
    }
@@ -1843,7 +1844,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
     */
     */
    private static final LogStatement LOGSTATEMENT_LATINIME_ONENDBATCHINPUT =
    private static final LogStatement LOGSTATEMENT_LATINIME_ONENDBATCHINPUT =
            new LogStatement("LatinIMEOnEndBatchInput", true, false, "enteredText",
            new LogStatement("LatinIMEOnEndBatchInput", true, false, "enteredText",
                    "enteredWordPos");
                    "enteredWordPos", "suggestedWords");
    public static void latinIME_onEndBatchInput(final CharSequence enteredText,
    public static void latinIME_onEndBatchInput(final CharSequence enteredText,
            final int enteredWordPos, final SuggestedWords suggestedWords) {
            final int enteredWordPos, final SuggestedWords suggestedWords) {
        final ResearchLogger researchLogger = getInstance();
        final ResearchLogger researchLogger = getInstance();
@@ -1851,7 +1852,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
            researchLogger.mCurrentLogUnit.setWords(enteredText.toString());
            researchLogger.mCurrentLogUnit.setWords(enteredText.toString());
        }
        }
        researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_ONENDBATCHINPUT, enteredText,
        researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_ONENDBATCHINPUT, enteredText,
                enteredWordPos);
                enteredWordPos, suggestedWords);
        researchLogger.mCurrentLogUnit.initializeSuggestions(suggestedWords);
        researchLogger.mCurrentLogUnit.initializeSuggestions(suggestedWords);
        researchLogger.mStatistics.recordGestureInput(enteredText.length(),
        researchLogger.mStatistics.recordGestureInput(enteredText.length(),
                SystemClock.uptimeMillis());
                SystemClock.uptimeMillis());