Loading core/api/current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -18668,6 +18668,7 @@ package android.inputmethodservice { method public boolean onKeyLongPress(int, android.view.KeyEvent); method public boolean onKeyMultiple(int, int, android.view.KeyEvent); method public boolean onKeyUp(int, android.view.KeyEvent); method public void onPrepareStylusHandwriting(); method public boolean onShowInputRequested(int, boolean); method public void onStartCandidatesView(android.view.inputmethod.EditorInfo, boolean); method public void onStartInput(android.view.inputmethod.EditorInfo, boolean); Loading Loading @@ -52768,6 +52769,9 @@ package android.view.inputmethod { method public default boolean setImeConsumesInput(boolean); method public boolean setSelection(int, int); method @Nullable public default android.view.inputmethod.TextSnapshot takeSnapshot(); field public static final int CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS = 8; // 0x8 field public static final int CURSOR_UPDATE_FILTER_EDITOR_BOUNDS = 4; // 0x4 field public static final int CURSOR_UPDATE_FILTER_INSERTION_MARKER = 16; // 0x10 field public static final int CURSOR_UPDATE_IMMEDIATE = 1; // 0x1 field public static final int CURSOR_UPDATE_MONITOR = 2; // 0x2 field public static final int GET_EXTRACTED_TEXT_MONITOR = 1; // 0x1 core/java/android/inputmethodservice/IInputMethodWrapper.java +11 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ class IInputMethodWrapper extends IInputMethod.Stub private static final int DO_CREATE_INLINE_SUGGESTIONS_REQUEST = 90; private static final int DO_CAN_START_STYLUS_HANDWRITING = 100; private static final int DO_START_STYLUS_HANDWRITING = 110; private static final int DO_INIT_INK_WINDOW = 120; final WeakReference<InputMethodServiceInternal> mTarget; final Context mContext; Loading Loading @@ -250,6 +251,10 @@ class IInputMethodWrapper extends IInputMethod.Stub args.recycle(); return; } case DO_INIT_INK_WINDOW: { inputMethod.initInkWindow(); return; } } Log.w(TAG, "Unhandled message code: " + msg.what); Loading Loading @@ -400,4 +405,10 @@ class IInputMethodWrapper extends IInputMethod.Stub mCaller.obtainMessageIOO(DO_START_STYLUS_HANDWRITING, requestId, channel, stylusEvents)); } @BinderThread @Override public void initInkWindow() { mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_INIT_INK_WINDOW)); } } core/java/android/inputmethodservice/InkWindow.java +19 −1 Original line number Diff line number Diff line Loading @@ -58,16 +58,27 @@ final class InkWindow extends PhoneWindow { mWindowManager = context.getSystemService(WindowManager.class); } /** * Initialize InkWindow if we only want to create and draw surface but not show it. */ void initOnly() { show(true /* keepInvisible */); } /** * Method to show InkWindow on screen. * Emulates internal behavior similar to Dialog.show(). */ void show() { show(false /* keepInvisible */); } private void show(boolean keepInvisible) { if (getDecorView() == null) { Slog.i(InputMethodService.TAG, "DecorView is not set for InkWindow. show() failed."); return; } getDecorView().setVisibility(View.VISIBLE); getDecorView().setVisibility(keepInvisible ? View.INVISIBLE : View.VISIBLE); if (!mIsViewAdded) { mWindowManager.addView(getDecorView(), getAttributes()); mIsViewAdded = true; Loading @@ -91,4 +102,11 @@ final class InkWindow extends PhoneWindow { lp.token = token; setAttributes(lp); } /** * Returns {@code true} if Window was created and added to WM. */ boolean isInitialized() { return mIsViewAdded; } } core/java/android/inputmethodservice/InputMethodService.java +31 −1 Original line number Diff line number Diff line Loading @@ -742,6 +742,10 @@ public class InputMethodService extends AbstractInputMethodService { onUnbindInput(); mInputBinding = null; mInputConnection = null; // free-up cached InkWindow surface on detaching from current client. if (mInkWindow != null) { mInkWindow.hide(true /* remove */); } } /** Loading Loading @@ -902,6 +906,10 @@ public class InputMethodService extends AbstractInputMethodService { Log.d(TAG, "Input should have started before starting Stylus handwriting."); return; } if (!mInkWindow.isInitialized()) { // prepare hasn't been called by Stylus HOVER. onPrepareStylusHandwriting(); } if (onStartStylusHandwriting()) { mPrivOps.onStylusHandwritingReady(requestId); } else { Loading Loading @@ -947,6 +955,16 @@ public class InputMethodService extends AbstractInputMethodService { } /** * {@inheritDoc} * @hide */ @Override public void initInkWindow() { mInkWindow.initOnly(); onPrepareStylusHandwriting(); } /** * {@inheritDoc} */ Loading Loading @@ -2319,6 +2337,18 @@ public class InputMethodService extends AbstractInputMethodService { } } /** * Called to prepare stylus handwriting. * The system calls this before the first {@link #onStartStylusHandwriting} request. * * <p>Note: The system tries to call this as early as possible, when it detects that * handwriting stylus input is imminent. However, that a subsequent call to * {@link #onStartStylusHandwriting} actually happens is not guaranteed.</p> */ public void onPrepareStylusHandwriting() { // Intentionally empty } /** * Called when an app requests stylus handwriting * {@link InputMethodManager#startStylusHandwriting(View)}. Loading core/java/android/view/inputmethod/InputConnection.java +62 −3 Original line number Diff line number Diff line Loading @@ -972,6 +972,13 @@ public interface InputConnection { * {@link InputMethodManager#updateCursorAnchorInfo(android.view.View, CursorAnchorInfo)} at * once, as soon as possible, regardless of cursor/anchor position changes. This flag can be * used together with {@link #CURSOR_UPDATE_MONITOR}. * <p> * Note by default all of {@link #CURSOR_UPDATE_FILTER_EDITOR_BOUNDS}, * {@link #CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS} and * {@link #CURSOR_UPDATE_FILTER_INSERTION_MARKER} are included but specifying them can * filter-out others. * It can be CPU intensive to include all, filtering specific info is recommended. * </p> */ int CURSOR_UPDATE_IMMEDIATE = 1 << 0; Loading @@ -983,17 +990,69 @@ public interface InputConnection { * <p> * This flag can be used together with {@link #CURSOR_UPDATE_IMMEDIATE}. * </p> * <p> * Note by default all of {@link #CURSOR_UPDATE_FILTER_EDITOR_BOUNDS}, * {@link #CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS} and * {@link #CURSOR_UPDATE_FILTER_INSERTION_MARKER} are included but specifying them can * filter-out others. * It can be CPU intensive to include all, filtering specific info is recommended. * </p> */ int CURSOR_UPDATE_MONITOR = 1 << 1; /** * The editor is requested to call * {@link InputMethodManager#updateCursorAnchorInfo(android.view.View, CursorAnchorInfo)} * with new {@link EditorBoundsInfo} whenever cursor/anchor position is changed. To disable * monitoring, call {@link InputConnection#requestCursorUpdates(int)} again with this flag off. * <p> * This flag can be used together with filters: {@link #CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS}, * {@link #CURSOR_UPDATE_FILTER_INSERTION_MARKER} and update flags * {@link #CURSOR_UPDATE_IMMEDIATE} and {@link #CURSOR_UPDATE_MONITOR}. * </p> */ int CURSOR_UPDATE_FILTER_EDITOR_BOUNDS = 1 << 2; /** * The editor is requested to call * {@link InputMethodManager#updateCursorAnchorInfo(android.view.View, CursorAnchorInfo)} * with new character bounds {@link CursorAnchorInfo#getCharacterBounds(int)} whenever * cursor/anchor position is changed. To disable * monitoring, call {@link InputConnection#requestCursorUpdates(int)} again with this flag off. * <p> * This flag can be combined with other filters: {@link #CURSOR_UPDATE_FILTER_EDITOR_BOUNDS}, * {@link #CURSOR_UPDATE_FILTER_INSERTION_MARKER} and update flags * {@link #CURSOR_UPDATE_IMMEDIATE} and {@link #CURSOR_UPDATE_MONITOR}. * </p> */ int CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS = 1 << 3; /** * The editor is requested to call * {@link InputMethodManager#updateCursorAnchorInfo(android.view.View, CursorAnchorInfo)} * with new Insertion marker info {@link CursorAnchorInfo#getInsertionMarkerFlags()}, * {@link CursorAnchorInfo#getInsertionMarkerBaseline()}, etc whenever cursor/anchor position is * changed. To disable monitoring, call {@link InputConnection#requestCursorUpdates(int)} again * with this flag off. * <p> * This flag can be combined with other filters: {@link #CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS}, * {@link #CURSOR_UPDATE_FILTER_EDITOR_BOUNDS} and update flags {@link #CURSOR_UPDATE_IMMEDIATE} * and {@link #CURSOR_UPDATE_MONITOR}. * </p> */ int CURSOR_UPDATE_FILTER_INSERTION_MARKER = 1 << 4; /** * 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 {@link #CURSOR_UPDATE_IMMEDIATE} and/or * {@link #CURSOR_UPDATE_MONITOR}. Pass {@code 0} to disable the effect of * {@link #CURSOR_UPDATE_MONITOR}. * @param cursorUpdateMode any combination of update modes and filters: * {@link #CURSOR_UPDATE_IMMEDIATE}, {@link #CURSOR_UPDATE_MONITOR}, and date filters: * {@link #CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS}, {@link #CURSOR_UPDATE_FILTER_EDITOR_BOUNDS}, * {@link #CURSOR_UPDATE_FILTER_INSERTION_MARKER}. * Pass {@code 0} to disable them. However, if an unknown flag is provided, request will be * rejected and method will return {@code false}. * @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)}. Loading Loading
core/api/current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -18668,6 +18668,7 @@ package android.inputmethodservice { method public boolean onKeyLongPress(int, android.view.KeyEvent); method public boolean onKeyMultiple(int, int, android.view.KeyEvent); method public boolean onKeyUp(int, android.view.KeyEvent); method public void onPrepareStylusHandwriting(); method public boolean onShowInputRequested(int, boolean); method public void onStartCandidatesView(android.view.inputmethod.EditorInfo, boolean); method public void onStartInput(android.view.inputmethod.EditorInfo, boolean); Loading Loading @@ -52768,6 +52769,9 @@ package android.view.inputmethod { method public default boolean setImeConsumesInput(boolean); method public boolean setSelection(int, int); method @Nullable public default android.view.inputmethod.TextSnapshot takeSnapshot(); field public static final int CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS = 8; // 0x8 field public static final int CURSOR_UPDATE_FILTER_EDITOR_BOUNDS = 4; // 0x4 field public static final int CURSOR_UPDATE_FILTER_INSERTION_MARKER = 16; // 0x10 field public static final int CURSOR_UPDATE_IMMEDIATE = 1; // 0x1 field public static final int CURSOR_UPDATE_MONITOR = 2; // 0x2 field public static final int GET_EXTRACTED_TEXT_MONITOR = 1; // 0x1
core/java/android/inputmethodservice/IInputMethodWrapper.java +11 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ class IInputMethodWrapper extends IInputMethod.Stub private static final int DO_CREATE_INLINE_SUGGESTIONS_REQUEST = 90; private static final int DO_CAN_START_STYLUS_HANDWRITING = 100; private static final int DO_START_STYLUS_HANDWRITING = 110; private static final int DO_INIT_INK_WINDOW = 120; final WeakReference<InputMethodServiceInternal> mTarget; final Context mContext; Loading Loading @@ -250,6 +251,10 @@ class IInputMethodWrapper extends IInputMethod.Stub args.recycle(); return; } case DO_INIT_INK_WINDOW: { inputMethod.initInkWindow(); return; } } Log.w(TAG, "Unhandled message code: " + msg.what); Loading Loading @@ -400,4 +405,10 @@ class IInputMethodWrapper extends IInputMethod.Stub mCaller.obtainMessageIOO(DO_START_STYLUS_HANDWRITING, requestId, channel, stylusEvents)); } @BinderThread @Override public void initInkWindow() { mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_INIT_INK_WINDOW)); } }
core/java/android/inputmethodservice/InkWindow.java +19 −1 Original line number Diff line number Diff line Loading @@ -58,16 +58,27 @@ final class InkWindow extends PhoneWindow { mWindowManager = context.getSystemService(WindowManager.class); } /** * Initialize InkWindow if we only want to create and draw surface but not show it. */ void initOnly() { show(true /* keepInvisible */); } /** * Method to show InkWindow on screen. * Emulates internal behavior similar to Dialog.show(). */ void show() { show(false /* keepInvisible */); } private void show(boolean keepInvisible) { if (getDecorView() == null) { Slog.i(InputMethodService.TAG, "DecorView is not set for InkWindow. show() failed."); return; } getDecorView().setVisibility(View.VISIBLE); getDecorView().setVisibility(keepInvisible ? View.INVISIBLE : View.VISIBLE); if (!mIsViewAdded) { mWindowManager.addView(getDecorView(), getAttributes()); mIsViewAdded = true; Loading @@ -91,4 +102,11 @@ final class InkWindow extends PhoneWindow { lp.token = token; setAttributes(lp); } /** * Returns {@code true} if Window was created and added to WM. */ boolean isInitialized() { return mIsViewAdded; } }
core/java/android/inputmethodservice/InputMethodService.java +31 −1 Original line number Diff line number Diff line Loading @@ -742,6 +742,10 @@ public class InputMethodService extends AbstractInputMethodService { onUnbindInput(); mInputBinding = null; mInputConnection = null; // free-up cached InkWindow surface on detaching from current client. if (mInkWindow != null) { mInkWindow.hide(true /* remove */); } } /** Loading Loading @@ -902,6 +906,10 @@ public class InputMethodService extends AbstractInputMethodService { Log.d(TAG, "Input should have started before starting Stylus handwriting."); return; } if (!mInkWindow.isInitialized()) { // prepare hasn't been called by Stylus HOVER. onPrepareStylusHandwriting(); } if (onStartStylusHandwriting()) { mPrivOps.onStylusHandwritingReady(requestId); } else { Loading Loading @@ -947,6 +955,16 @@ public class InputMethodService extends AbstractInputMethodService { } /** * {@inheritDoc} * @hide */ @Override public void initInkWindow() { mInkWindow.initOnly(); onPrepareStylusHandwriting(); } /** * {@inheritDoc} */ Loading Loading @@ -2319,6 +2337,18 @@ public class InputMethodService extends AbstractInputMethodService { } } /** * Called to prepare stylus handwriting. * The system calls this before the first {@link #onStartStylusHandwriting} request. * * <p>Note: The system tries to call this as early as possible, when it detects that * handwriting stylus input is imminent. However, that a subsequent call to * {@link #onStartStylusHandwriting} actually happens is not guaranteed.</p> */ public void onPrepareStylusHandwriting() { // Intentionally empty } /** * Called when an app requests stylus handwriting * {@link InputMethodManager#startStylusHandwriting(View)}. Loading
core/java/android/view/inputmethod/InputConnection.java +62 −3 Original line number Diff line number Diff line Loading @@ -972,6 +972,13 @@ public interface InputConnection { * {@link InputMethodManager#updateCursorAnchorInfo(android.view.View, CursorAnchorInfo)} at * once, as soon as possible, regardless of cursor/anchor position changes. This flag can be * used together with {@link #CURSOR_UPDATE_MONITOR}. * <p> * Note by default all of {@link #CURSOR_UPDATE_FILTER_EDITOR_BOUNDS}, * {@link #CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS} and * {@link #CURSOR_UPDATE_FILTER_INSERTION_MARKER} are included but specifying them can * filter-out others. * It can be CPU intensive to include all, filtering specific info is recommended. * </p> */ int CURSOR_UPDATE_IMMEDIATE = 1 << 0; Loading @@ -983,17 +990,69 @@ public interface InputConnection { * <p> * This flag can be used together with {@link #CURSOR_UPDATE_IMMEDIATE}. * </p> * <p> * Note by default all of {@link #CURSOR_UPDATE_FILTER_EDITOR_BOUNDS}, * {@link #CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS} and * {@link #CURSOR_UPDATE_FILTER_INSERTION_MARKER} are included but specifying them can * filter-out others. * It can be CPU intensive to include all, filtering specific info is recommended. * </p> */ int CURSOR_UPDATE_MONITOR = 1 << 1; /** * The editor is requested to call * {@link InputMethodManager#updateCursorAnchorInfo(android.view.View, CursorAnchorInfo)} * with new {@link EditorBoundsInfo} whenever cursor/anchor position is changed. To disable * monitoring, call {@link InputConnection#requestCursorUpdates(int)} again with this flag off. * <p> * This flag can be used together with filters: {@link #CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS}, * {@link #CURSOR_UPDATE_FILTER_INSERTION_MARKER} and update flags * {@link #CURSOR_UPDATE_IMMEDIATE} and {@link #CURSOR_UPDATE_MONITOR}. * </p> */ int CURSOR_UPDATE_FILTER_EDITOR_BOUNDS = 1 << 2; /** * The editor is requested to call * {@link InputMethodManager#updateCursorAnchorInfo(android.view.View, CursorAnchorInfo)} * with new character bounds {@link CursorAnchorInfo#getCharacterBounds(int)} whenever * cursor/anchor position is changed. To disable * monitoring, call {@link InputConnection#requestCursorUpdates(int)} again with this flag off. * <p> * This flag can be combined with other filters: {@link #CURSOR_UPDATE_FILTER_EDITOR_BOUNDS}, * {@link #CURSOR_UPDATE_FILTER_INSERTION_MARKER} and update flags * {@link #CURSOR_UPDATE_IMMEDIATE} and {@link #CURSOR_UPDATE_MONITOR}. * </p> */ int CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS = 1 << 3; /** * The editor is requested to call * {@link InputMethodManager#updateCursorAnchorInfo(android.view.View, CursorAnchorInfo)} * with new Insertion marker info {@link CursorAnchorInfo#getInsertionMarkerFlags()}, * {@link CursorAnchorInfo#getInsertionMarkerBaseline()}, etc whenever cursor/anchor position is * changed. To disable monitoring, call {@link InputConnection#requestCursorUpdates(int)} again * with this flag off. * <p> * This flag can be combined with other filters: {@link #CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS}, * {@link #CURSOR_UPDATE_FILTER_EDITOR_BOUNDS} and update flags {@link #CURSOR_UPDATE_IMMEDIATE} * and {@link #CURSOR_UPDATE_MONITOR}. * </p> */ int CURSOR_UPDATE_FILTER_INSERTION_MARKER = 1 << 4; /** * 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 {@link #CURSOR_UPDATE_IMMEDIATE} and/or * {@link #CURSOR_UPDATE_MONITOR}. Pass {@code 0} to disable the effect of * {@link #CURSOR_UPDATE_MONITOR}. * @param cursorUpdateMode any combination of update modes and filters: * {@link #CURSOR_UPDATE_IMMEDIATE}, {@link #CURSOR_UPDATE_MONITOR}, and date filters: * {@link #CURSOR_UPDATE_FILTER_CHARACTER_BOUNDS}, {@link #CURSOR_UPDATE_FILTER_EDITOR_BOUNDS}, * {@link #CURSOR_UPDATE_FILTER_INSERTION_MARKER}. * Pass {@code 0} to disable them. However, if an unknown flag is provided, request will be * rejected and method will return {@code false}. * @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)}. Loading