Loading core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -52951,6 +52951,7 @@ package android.view.inputmethod { method public default boolean performSpellCheck(); method public boolean reportFullscreenMode(boolean); method public boolean requestCursorUpdates(int); method public default boolean requestCursorUpdates(int, int); method public boolean sendKeyEvent(android.view.KeyEvent); method public boolean setComposingRegion(int, int); method public default boolean setComposingRegion(int, int, @Nullable android.view.inputmethod.TextAttribute); core/java/android/inputmethodservice/RemoteInputConnection.java +20 −0 Original line number Diff line number Diff line Loading @@ -433,6 +433,26 @@ public final class RemoteInputConnection implements InputConnection { mCancellationGroup, MAX_WAIT_TIME_MILLIS); } @Override @AnyThread public boolean requestCursorUpdates(@CursorUpdateMode int cursorUpdateMode, @CursorUpdateFilter int cursorUpdateFilter) { if (mCancellationGroup.isCanceled()) { return false; } final InputMethodServiceInternal ims = mImsInternal.getAndWarnIfNull(); if (ims == null) { return false; } final int displayId = ims.getContext().getDisplayId(); final CompletableFuture<Boolean> value = mInvoker.requestCursorUpdates(cursorUpdateMode, cursorUpdateFilter, displayId); return CompletableFutureUtil.getResultOrFalse(value, TAG, "requestCursorUpdates()", mCancellationGroup, MAX_WAIT_TIME_MILLIS); } @AnyThread public Handler getHandler() { // Nothing should happen when called from input method. Loading core/java/android/view/inputmethod/CursorAnchorInfo.java +3 −1 Original line number Diff line number Diff line Loading @@ -575,7 +575,9 @@ public final class CursorAnchorInfo implements Parcelable { } /** * Returns {@link EditorBoundsInfo} editor related bounds. * Returns {@link EditorBoundsInfo} for the current editor, or {@code null} if IME is not * subscribed with {@link InputConnection#CURSOR_UPDATE_FILTER_EDITOR_BOUNDS} * or {@link InputConnection#CURSOR_UPDATE_MONITOR}. */ @Nullable public EditorBoundsInfo getEditorBoundsInfo() { Loading core/java/android/view/inputmethod/EditorBoundsInfo.java +3 −3 Original line number Diff line number Diff line Loading @@ -30,13 +30,13 @@ import java.util.Objects; public final class EditorBoundsInfo implements Parcelable { /** * Container of rectangular position of Editor in the current window. * The bounding box of the of currently focused text editor in local coordinates. */ private final RectF mEditorBounds; /** * Container of rectangular position of Editor with additional padding around for initiating * Stylus Handwriting in the current window. * The bounding box of the of currently focused text editor with additional padding around it * for initiating Stylus Handwriting in the current window. */ private final RectF mHandwritingBounds; Loading core/java/android/view/inputmethod/InputConnection.java +45 −0 Original line number Diff line number Diff line Loading @@ -1042,6 +1042,23 @@ public interface InputConnection { */ int CURSOR_UPDATE_FILTER_INSERTION_MARKER = 1 << 4; /** * @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(value = {CURSOR_UPDATE_IMMEDIATE, CURSOR_UPDATE_MONITOR}, flag = true, prefix = { "CURSOR_UPDATE_" }) @interface CursorUpdateMode{} /** * @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(value = {CURSOR_UPDATE_FILTER_EDITOR_BOUNDS, CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS, CURSOR_UPDATE_FILTER_INSERTION_MARKER}, flag = true, prefix = { "CURSOR_UPDATE_FILTER_" }) @interface CursorUpdateFilter{} /** * Called by the input method to ask the editor for calling back * {@link InputMethodManager#updateCursorAnchorInfo(android.view.View, CursorAnchorInfo)} to Loading @@ -1062,6 +1079,34 @@ public interface InputConnection { */ boolean requestCursorUpdates(int cursorUpdateMode); /** * Called by the input method to ask the editor for calling back * {@link InputMethodManager#updateCursorAnchorInfo(android.view.View, CursorAnchorInfo)} to * notify cursor/anchor locations. * * @param cursorUpdateMode combination of update modes: * {@link #CURSOR_UPDATE_IMMEDIATE}, {@link #CURSOR_UPDATE_MONITOR} * @param cursorUpdateFilter any combination of data filters: * {@link #CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS}, {@link #CURSOR_UPDATE_FILTER_EDITOR_BOUNDS}, * {@link #CURSOR_UPDATE_FILTER_INSERTION_MARKER}. * * <p>Pass {@code 0} to disable them. However, if an unknown flag is provided, request will be * rejected and method will return {@code false}.</p> * @return {@code true} if the request is scheduled. {@code false} to indicate that when the * application will not call {@link InputMethodManager#updateCursorAnchorInfo( * android.view.View, CursorAnchorInfo)}. * Since Android {@link android.os.Build.VERSION_CODES#N} until * {@link android.os.Build.VERSION_CODES#TIRAMISU}, this API returned {@code false} when * the target application does not implement this method. */ default boolean requestCursorUpdates(@CursorUpdateMode int cursorUpdateMode, @CursorUpdateFilter int cursorUpdateFilter) { if (cursorUpdateFilter == 0) { return requestCursorUpdates(cursorUpdateMode); } return false; } /** * Called by the system to enable application developers to specify a dedicated thread on which * {@link InputConnection} methods are called back. Loading Loading
core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -52951,6 +52951,7 @@ package android.view.inputmethod { method public default boolean performSpellCheck(); method public boolean reportFullscreenMode(boolean); method public boolean requestCursorUpdates(int); method public default boolean requestCursorUpdates(int, int); method public boolean sendKeyEvent(android.view.KeyEvent); method public boolean setComposingRegion(int, int); method public default boolean setComposingRegion(int, int, @Nullable android.view.inputmethod.TextAttribute);
core/java/android/inputmethodservice/RemoteInputConnection.java +20 −0 Original line number Diff line number Diff line Loading @@ -433,6 +433,26 @@ public final class RemoteInputConnection implements InputConnection { mCancellationGroup, MAX_WAIT_TIME_MILLIS); } @Override @AnyThread public boolean requestCursorUpdates(@CursorUpdateMode int cursorUpdateMode, @CursorUpdateFilter int cursorUpdateFilter) { if (mCancellationGroup.isCanceled()) { return false; } final InputMethodServiceInternal ims = mImsInternal.getAndWarnIfNull(); if (ims == null) { return false; } final int displayId = ims.getContext().getDisplayId(); final CompletableFuture<Boolean> value = mInvoker.requestCursorUpdates(cursorUpdateMode, cursorUpdateFilter, displayId); return CompletableFutureUtil.getResultOrFalse(value, TAG, "requestCursorUpdates()", mCancellationGroup, MAX_WAIT_TIME_MILLIS); } @AnyThread public Handler getHandler() { // Nothing should happen when called from input method. Loading
core/java/android/view/inputmethod/CursorAnchorInfo.java +3 −1 Original line number Diff line number Diff line Loading @@ -575,7 +575,9 @@ public final class CursorAnchorInfo implements Parcelable { } /** * Returns {@link EditorBoundsInfo} editor related bounds. * Returns {@link EditorBoundsInfo} for the current editor, or {@code null} if IME is not * subscribed with {@link InputConnection#CURSOR_UPDATE_FILTER_EDITOR_BOUNDS} * or {@link InputConnection#CURSOR_UPDATE_MONITOR}. */ @Nullable public EditorBoundsInfo getEditorBoundsInfo() { Loading
core/java/android/view/inputmethod/EditorBoundsInfo.java +3 −3 Original line number Diff line number Diff line Loading @@ -30,13 +30,13 @@ import java.util.Objects; public final class EditorBoundsInfo implements Parcelable { /** * Container of rectangular position of Editor in the current window. * The bounding box of the of currently focused text editor in local coordinates. */ private final RectF mEditorBounds; /** * Container of rectangular position of Editor with additional padding around for initiating * Stylus Handwriting in the current window. * The bounding box of the of currently focused text editor with additional padding around it * for initiating Stylus Handwriting in the current window. */ private final RectF mHandwritingBounds; Loading
core/java/android/view/inputmethod/InputConnection.java +45 −0 Original line number Diff line number Diff line Loading @@ -1042,6 +1042,23 @@ public interface InputConnection { */ int CURSOR_UPDATE_FILTER_INSERTION_MARKER = 1 << 4; /** * @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(value = {CURSOR_UPDATE_IMMEDIATE, CURSOR_UPDATE_MONITOR}, flag = true, prefix = { "CURSOR_UPDATE_" }) @interface CursorUpdateMode{} /** * @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(value = {CURSOR_UPDATE_FILTER_EDITOR_BOUNDS, CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS, CURSOR_UPDATE_FILTER_INSERTION_MARKER}, flag = true, prefix = { "CURSOR_UPDATE_FILTER_" }) @interface CursorUpdateFilter{} /** * Called by the input method to ask the editor for calling back * {@link InputMethodManager#updateCursorAnchorInfo(android.view.View, CursorAnchorInfo)} to Loading @@ -1062,6 +1079,34 @@ public interface InputConnection { */ boolean requestCursorUpdates(int cursorUpdateMode); /** * Called by the input method to ask the editor for calling back * {@link InputMethodManager#updateCursorAnchorInfo(android.view.View, CursorAnchorInfo)} to * notify cursor/anchor locations. * * @param cursorUpdateMode combination of update modes: * {@link #CURSOR_UPDATE_IMMEDIATE}, {@link #CURSOR_UPDATE_MONITOR} * @param cursorUpdateFilter any combination of data filters: * {@link #CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS}, {@link #CURSOR_UPDATE_FILTER_EDITOR_BOUNDS}, * {@link #CURSOR_UPDATE_FILTER_INSERTION_MARKER}. * * <p>Pass {@code 0} to disable them. However, if an unknown flag is provided, request will be * rejected and method will return {@code false}.</p> * @return {@code true} if the request is scheduled. {@code false} to indicate that when the * application will not call {@link InputMethodManager#updateCursorAnchorInfo( * android.view.View, CursorAnchorInfo)}. * Since Android {@link android.os.Build.VERSION_CODES#N} until * {@link android.os.Build.VERSION_CODES#TIRAMISU}, this API returned {@code false} when * the target application does not implement this method. */ default boolean requestCursorUpdates(@CursorUpdateMode int cursorUpdateMode, @CursorUpdateFilter int cursorUpdateFilter) { if (cursorUpdateFilter == 0) { return requestCursorUpdates(cursorUpdateMode); } return false; } /** * Called by the system to enable application developers to specify a dedicated thread on which * {@link InputConnection} methods are called back. Loading