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

Commit 5854c92b authored by Taran Singh's avatar Taran Singh
Browse files

Don't auto subscribe to CAI for stylus handwriting

In [1] & [2] we introduce auto-subscription for editor bounds to IME. However,
it is actually better for IME to do it due to following reasons:
1. Simpler for IMEs do it. Easier state management in IME as to
   what is subscribed.
2. IME can subscribe to CusrosAnchorInfo as early as onStartInput(), which
   delivers required CAI even sooner to IME resulting in faster
   Handwriting startup.
3. We cannot predict what data IME may need. e.g. IME may not
   implement Rich handwriting gestures and hence may not need line
   bounds (Line bounds will be added in near future).

This CL essentially mechanically reverts [1] and a small part of [2]
No user observable behavior change.

[1] I3d6b1728d62139785593af14c24cb52bf2c91e31
[2] Ibba06e9a2533ca91c5cc215dfb18d21c9a74fb73

Fix: 238970465
Bug: 203086136
Bug: 210039666
Bug: 215533103
Test: atest CtsInputMethodTestCases
Change-Id: Ia72a9fe0ceac1798ee1989eaae3906e8e1b696bf
parent 0148b606
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package android.view.inputmethod;

import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
import static android.Manifest.permission.WRITE_SECURE_SETTINGS;
import static android.view.inputmethod.InputConnection.CURSOR_UPDATE_FILTER_EDITOR_BOUNDS;
import static android.view.inputmethod.InputConnection.CURSOR_UPDATE_IMMEDIATE;
import static android.view.inputmethod.InputConnection.CURSOR_UPDATE_MONITOR;
import static android.view.inputmethod.InputMethodEditorTraceProto.InputMethodClientsTraceProto.ClientSideProto.DISPLAY_ID;
@@ -2086,15 +2085,6 @@ public final class InputMethodManager {
                Log.w(TAG, "Ignoring startStylusHandwriting: View's window does not have focus.");
                return;
            }
            if (mServedInputConnection != null && getDelegate().hasActiveConnection(view)) {
                // TODO (b/210039666): optimize CURSOR_UPDATE_IMMEDIATE.
                // TODO (b/210039666): Pipe IME displayId from InputBindResult and use it here.
                //  instead of mDisplayId.
                mServedInputConnection.requestCursorUpdatesFromImm(
                        CURSOR_UPDATE_IMMEDIATE | CURSOR_UPDATE_MONITOR,
                                CURSOR_UPDATE_FILTER_EDITOR_BOUNDS,
                        mDisplayId);
            }

            mServiceInvoker.startStylusHandwriting(mClient);
            // TODO(b/210039666): do we need any extra work for supporting non-native
+0 −21
Original line number Diff line number Diff line
@@ -968,27 +968,6 @@ public final class RemoteInputConnectionImpl extends IRemoteInputConnection.Stub
        });
    }

    /**
     * Dispatches {@link InputConnection#requestCursorUpdates(int)}.
     *
     * <p>This method is intended to be called only from {@link InputMethodManager}.</p>
     * @param cursorUpdateMode the mode for {@link InputConnection#requestCursorUpdates(int, int)}
     * @param cursorUpdateFilter the filter for
     *      {@link InputConnection#requestCursorUpdates(int, int)}
     * @param imeDisplayId displayId on which IME is displayed.
     */
    @Dispatching(cancellable = true)
    public void requestCursorUpdatesFromImm(int cursorUpdateMode, int cursorUpdateFilter,
            int imeDisplayId) {
        final int currentSessionId = mCurrentSessionId.get();
        dispatchWithTracing("requestCursorUpdatesFromImm", () -> {
            if (currentSessionId != mCurrentSessionId.get()) {
                return;  // cancelled
            }
            requestCursorUpdatesInternal(cursorUpdateMode, cursorUpdateFilter, imeDisplayId);
        });
    }

    @Dispatching(cancellable = true)
    @Override
    public void requestCursorUpdates(InputConnectionCommandHeader header, int cursorUpdateMode,