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

Commit 96640a11 authored by Tom Ouyang's avatar Tom Ouyang
Browse files

Small optimization to eliminate a >0 check in RichInputConnection.

Change-Id: Ibdf97726008c1f94c970461196ba445ce328a8cb
parent ecea6a61
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ public final class RichInputConnection implements PrivateCommandPerformer {
    /**
     * The timestamp of the last slow InputConnection operation
     */
    private long mLastSlowInputConnectionTime = 0;
    private long mLastSlowInputConnectionTime = -SLOW_INPUTCONNECTION_PERSIST_MS;

    public RichInputConnection(final InputMethodService parent) {
        mParent = parent;
@@ -143,13 +143,12 @@ public final class RichInputConnection implements PrivateCommandPerformer {
     * calling InputConnection methods that trigger an IPC round-trip (e.g., getTextAfterCursor).
     */
    public boolean hasSlowInputConnection() {
        return mLastSlowInputConnectionTime > 0 &&
                (SystemClock.uptimeMillis() - mLastSlowInputConnectionTime)
        return (SystemClock.uptimeMillis() - mLastSlowInputConnectionTime)
                        <= SLOW_INPUTCONNECTION_PERSIST_MS;
    }

    public void onStartInput() {
        mLastSlowInputConnectionTime = 0;
        mLastSlowInputConnectionTime = -SLOW_INPUTCONNECTION_PERSIST_MS;
    }

    private void checkConsistencyForDebug() {