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

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

Merge "[Rlog59b] Log CodeInput and KeyCode properly"

parents b75e2380 99931201
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -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
@@ -2327,6 +2327,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();
            }
        }
    }

+20 −3
Original line number Diff line number Diff line
@@ -1179,9 +1179,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
    /**
     * Log a call to LatinIME.sendKeyCodePoint().
     *
     * SystemResponse: The IME is simulating a hardware keypress.  This happens for numbers; other
     * input typically goes through RichInputConnection.setComposingText() and
     * RichInputConnection.commitText().
     * SystemResponse: The IME is inserting text into the TextView for numbers, fixed strings, or
     * some other unusual mechanism.
     */
    private static final LogStatement LOGSTATEMENT_LATINIME_SENDKEYCODEPOINT =
            new LogStatement("LatinIMESendKeyCodePoint", true, false, "code");
@@ -1194,6 +1193,24 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
        }
    }

    /**
     * Log a call to LatinIME.promotePhantomSpace().
     *
     * SystemResponse: The IME is inserting a real space in place of a phantom space.
     */
    private static final LogStatement LOGSTATEMENT_LATINIME_PROMOTEPHANTOMSPACE =
            new LogStatement("LatinIMEPromotPhantomSpace", false, false);
    public static void latinIME_promotePhantomSpace() {
        final ResearchLogger researchLogger = getInstance();
        final LogUnit logUnit;
        if (researchLogger.mMainLogBuffer == null) {
            logUnit = researchLogger.mCurrentLogUnit;
        } else {
            logUnit = researchLogger.mMainLogBuffer.peekLastLogUnit();
        }
        researchLogger.enqueueEvent(logUnit, LOGSTATEMENT_LATINIME_PROMOTEPHANTOMSPACE);
    }

    /**
     * Log a call to LatinIME.swapSwapperAndSpace().
     *