From 5854c92badb8c6b095f4ddc0c70ea2f6759c5029 Mon Sep 17 00:00:00 2001 From: Taran Singh Date: Thu, 11 Aug 2022 17:42:36 +0000 Subject: [PATCH] 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 --- .../view/inputmethod/InputMethodManager.java | 10 --------- .../RemoteInputConnectionImpl.java | 21 ------------------- 2 files changed, 31 deletions(-) diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 0c03d109f649b..a01decca52240 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -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 diff --git a/core/java/com/android/internal/inputmethod/RemoteInputConnectionImpl.java b/core/java/com/android/internal/inputmethod/RemoteInputConnectionImpl.java index 2bef10f1aee57..b63ce1b22cdbb 100644 --- a/core/java/com/android/internal/inputmethod/RemoteInputConnectionImpl.java +++ b/core/java/com/android/internal/inputmethod/RemoteInputConnectionImpl.java @@ -968,27 +968,6 @@ public final class RemoteInputConnectionImpl extends IRemoteInputConnection.Stub }); } - /** - * Dispatches {@link InputConnection#requestCursorUpdates(int)}. - * - *

This method is intended to be called only from {@link InputMethodManager}.

- * @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,