Loading core/api/current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -18904,6 +18904,7 @@ package android.inputmethodservice { method public void onUnbindInput(); method @Deprecated public void onUpdateCursor(android.graphics.Rect); method public void onUpdateCursorAnchorInfo(android.view.inputmethod.CursorAnchorInfo); method public void onUpdateEditorToolType(int); method public void onUpdateExtractedText(int, android.view.inputmethod.ExtractedText); method public void onUpdateExtractingViews(android.view.inputmethod.EditorInfo); method public void onUpdateExtractingVisibility(android.view.inputmethod.EditorInfo); Loading Loading @@ -52968,9 +52969,11 @@ package android.view.inputmethod { method @Nullable public android.view.inputmethod.SurroundingText getInitialSurroundingText(@IntRange(from=0) int, @IntRange(from=0) int, int); method @Nullable public CharSequence getInitialTextAfterCursor(@IntRange(from=0) int, int); method @Nullable public CharSequence getInitialTextBeforeCursor(@IntRange(from=0) int, int); method public int getInitialToolType(); method public final void makeCompatible(int); method public void setInitialSurroundingSubText(@NonNull CharSequence, int); method public void setInitialSurroundingText(@NonNull CharSequence); method public void setInitialToolType(int); method public void writeToParcel(android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.EditorInfo> CREATOR; field public static final int IME_ACTION_DONE = 6; // 0x6 core/java/android/inputmethodservice/IInputMethodWrapper.java +13 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ class IInputMethodWrapper extends IInputMethod.Stub private static final int DO_START_STYLUS_HANDWRITING = 110; private static final int DO_INIT_INK_WINDOW = 120; private static final int DO_FINISH_STYLUS_HANDWRITING = 130; private static final int DO_UPDATE_TOOL_TYPE = 140; final WeakReference<InputMethodServiceInternal> mTarget; final Context mContext; Loading Loading @@ -234,6 +235,10 @@ class IInputMethodWrapper extends IInputMethod.Stub inputMethod.canStartStylusHandwriting(msg.arg1); return; } case DO_UPDATE_TOOL_TYPE: { inputMethod.updateEditorToolType(msg.arg1); return; } case DO_START_STYLUS_HANDWRITING: { final SomeArgs args = (SomeArgs) msg.obj; inputMethod.startStylusHandwriting(msg.arg1, (InputChannel) args.arg1, Loading Loading @@ -400,6 +405,14 @@ class IInputMethodWrapper extends IInputMethod.Stub mCaller.obtainMessageI(DO_CAN_START_STYLUS_HANDWRITING, requestId)); } @BinderThread @Override public void updateEditorToolType(int toolType) throws RemoteException { mCaller.executeOrSendMessage( mCaller.obtainMessageI(DO_UPDATE_TOOL_TYPE, toolType)); } @BinderThread @Override public void startStylusHandwriting(int requestId, @NonNull InputChannel channel, Loading core/java/android/inputmethodservice/InputMethodService.java +25 −0 Original line number Diff line number Diff line Loading @@ -948,6 +948,15 @@ public class InputMethodService extends AbstractInputMethodService { Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } /** * {@inheritDoc} * @hide */ @Override public void updateEditorToolType(int toolType) { onUpdateEditorToolType(toolType); } /** * {@inheritDoc} * @hide Loading Loading @@ -3012,17 +3021,33 @@ public class InputMethodService extends AbstractInputMethodService { * not call to inform the IME of this interaction. * @param focusChanged true if the user changed the focused view by this click. * @see InputMethodManager#viewClicked(View) * @see #onUpdateEditorToolType(int) * @deprecated The method may not be called for composite {@link View} that works as a giant * "Canvas", which can host its own UI hierarchy and sub focus state. * {@link android.webkit.WebView} is a good example. Application / IME developers * should not rely on this method. If your goal is just being notified when an * on-going input is interrupted, simply monitor {@link #onFinishInput()}. * If your goal is to know what {@link MotionEvent#getToolType(int)} clicked on * editor, use {@link #onUpdateEditorToolType(int)} instead. */ @Deprecated public void onViewClicked(boolean focusChanged) { // Intentionally empty } /** * Called when the user tapped or clicked an {@link android.widget.Editor}. * This can be useful when IME makes a decision of showing Virtual keyboard based on what * {@link MotionEvent#getToolType(int)} was used to click the editor. * e.g. when toolType is {@link MotionEvent#TOOL_TYPE_STYLUS}, IME may choose to show a * companion widget instead of normal virtual keyboard. * <p> Default implementation does nothing. </p> * @param toolType what {@link MotionEvent#getToolType(int)} was used to click on editor. */ public void onUpdateEditorToolType(int toolType) { // Intentionally empty } /** * Called when the application has reported a new location of its text * cursor. This is only called if explicitly requested by the input method. Loading core/java/android/view/ViewRootImpl.java +16 −1 Original line number Diff line number Diff line Loading @@ -734,6 +734,8 @@ public final class ViewRootImpl implements ViewParent, final PointF mDragPoint = new PointF(); final PointF mLastTouchPoint = new PointF(); int mLastTouchSource; /** Tracks last {@link MotionEvent#getToolType(int)} with {@link MotionEvent#ACTION_UP}. **/ private int mLastClickToolType; private boolean mProfileRendering; private Choreographer.FrameCallback mRenderProfiler; Loading Loading @@ -6417,11 +6419,16 @@ public final class ViewRootImpl implements ViewParent, event.offsetLocation(0, mCurScrollY); } // Remember the touch position for possible drag-initiation. if (event.isTouchEvent()) { // Remember the touch position for possible drag-initiation. mLastTouchPoint.x = event.getRawX(); mLastTouchPoint.y = event.getRawY(); mLastTouchSource = event.getSource(); // Register last ACTION_UP. This will be propagated to IME. if (event.getActionMasked() == MotionEvent.ACTION_UP) { mLastClickToolType = event.getToolType(event.getActionIndex()); } } return FORWARD; } Loading Loading @@ -8017,6 +8024,14 @@ public final class ViewRootImpl implements ViewParent, return mLastTouchSource; } /** * Used by InputMethodManager. * @hide */ public int getLastClickToolType() { return mLastClickToolType; } public void setDragFocus(View newDragTarget, DragEvent event) { if (mCurrentDragView != newDragTarget && !View.sCascadedDragDrop) { // Send EXITED and ENTERED notifications to the old and new drag focus views. Loading core/java/android/view/inputmethod/EditorInfo.java +37 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.content.res.Configuration; import android.inputmethodservice.InputMethodService; import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.LocaleList; Loading @@ -40,6 +41,7 @@ import android.text.InputType; import android.text.TextUtils; import android.util.Printer; import android.util.proto.ProtoOutputStream; import android.view.MotionEvent; import android.view.View; import android.view.autofill.AutofillId; Loading Loading @@ -564,6 +566,12 @@ public class EditorInfo implements InputType, Parcelable { @Nullable private SurroundingText mInitialSurroundingText = null; /** * Initial {@link MotionEvent#ACTION_UP} tool type {@link MotionEvent#getToolType(int)} that * was used to focus this editor. */ private int mInitialToolType = MotionEvent.TOOL_TYPE_UNKNOWN; /** * Editors may use this method to provide initial input text to IMEs. As the surrounding text Loading Loading @@ -936,6 +944,31 @@ public class EditorInfo implements InputType, Parcelable { } } /** * Returns the initial {@link MotionEvent#ACTION_UP} tool type * {@link MotionEvent#getToolType(int)} responsible for focus on the current editor. * * @see #setInitialToolType(int) * @see MotionEvent#getToolType(int) * @see InputMethodService#onUpdateEditorToolType(int) * @return toolType {@link MotionEvent#getToolType(int)}. */ public int getInitialToolType() { return mInitialToolType; } /** * Set the initial {@link MotionEvent#ACTION_UP} tool type {@link MotionEvent#getToolType(int)}. * that brought focus to the view. * * @see #getInitialToolType() * @see MotionEvent#getToolType(int) * @see InputMethodService#onUpdateEditorToolType(int) */ public void setInitialToolType(int toolType) { mInitialToolType = toolType; } /** * Export the state of {@link EditorInfo} into a protocol buffer output stream. * Loading Loading @@ -972,6 +1005,7 @@ public class EditorInfo implements InputType, Parcelable { + " actionId=" + actionId); pw.println(prefix + "initialSelStart=" + initialSelStart + " initialSelEnd=" + initialSelEnd + " initialToolType=" + mInitialToolType + " initialCapsMode=0x" + Integer.toHexString(initialCapsMode)); pw.println(prefix + "hintText=" + hintText Loading Loading @@ -1006,6 +1040,7 @@ public class EditorInfo implements InputType, Parcelable { newEditorInfo.initialSelStart = initialSelStart; newEditorInfo.initialSelEnd = initialSelEnd; newEditorInfo.initialCapsMode = initialCapsMode; newEditorInfo.mInitialToolType = mInitialToolType; newEditorInfo.hintText = TextUtils.stringOrSpannedString(hintText); newEditorInfo.label = TextUtils.stringOrSpannedString(label); newEditorInfo.packageName = packageName; Loading Loading @@ -1036,6 +1071,7 @@ public class EditorInfo implements InputType, Parcelable { dest.writeInt(initialSelStart); dest.writeInt(initialSelEnd); dest.writeInt(initialCapsMode); dest.writeInt(mInitialToolType); TextUtils.writeToParcel(hintText, dest, flags); TextUtils.writeToParcel(label, dest, flags); dest.writeString(packageName); Loading Loading @@ -1072,6 +1108,7 @@ public class EditorInfo implements InputType, Parcelable { res.initialSelStart = source.readInt(); res.initialSelEnd = source.readInt(); res.initialCapsMode = source.readInt(); res.mInitialToolType = source.readInt(); res.hintText = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); res.label = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); res.packageName = source.readString(); Loading Loading
core/api/current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -18904,6 +18904,7 @@ package android.inputmethodservice { method public void onUnbindInput(); method @Deprecated public void onUpdateCursor(android.graphics.Rect); method public void onUpdateCursorAnchorInfo(android.view.inputmethod.CursorAnchorInfo); method public void onUpdateEditorToolType(int); method public void onUpdateExtractedText(int, android.view.inputmethod.ExtractedText); method public void onUpdateExtractingViews(android.view.inputmethod.EditorInfo); method public void onUpdateExtractingVisibility(android.view.inputmethod.EditorInfo); Loading Loading @@ -52968,9 +52969,11 @@ package android.view.inputmethod { method @Nullable public android.view.inputmethod.SurroundingText getInitialSurroundingText(@IntRange(from=0) int, @IntRange(from=0) int, int); method @Nullable public CharSequence getInitialTextAfterCursor(@IntRange(from=0) int, int); method @Nullable public CharSequence getInitialTextBeforeCursor(@IntRange(from=0) int, int); method public int getInitialToolType(); method public final void makeCompatible(int); method public void setInitialSurroundingSubText(@NonNull CharSequence, int); method public void setInitialSurroundingText(@NonNull CharSequence); method public void setInitialToolType(int); method public void writeToParcel(android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.EditorInfo> CREATOR; field public static final int IME_ACTION_DONE = 6; // 0x6
core/java/android/inputmethodservice/IInputMethodWrapper.java +13 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ class IInputMethodWrapper extends IInputMethod.Stub private static final int DO_START_STYLUS_HANDWRITING = 110; private static final int DO_INIT_INK_WINDOW = 120; private static final int DO_FINISH_STYLUS_HANDWRITING = 130; private static final int DO_UPDATE_TOOL_TYPE = 140; final WeakReference<InputMethodServiceInternal> mTarget; final Context mContext; Loading Loading @@ -234,6 +235,10 @@ class IInputMethodWrapper extends IInputMethod.Stub inputMethod.canStartStylusHandwriting(msg.arg1); return; } case DO_UPDATE_TOOL_TYPE: { inputMethod.updateEditorToolType(msg.arg1); return; } case DO_START_STYLUS_HANDWRITING: { final SomeArgs args = (SomeArgs) msg.obj; inputMethod.startStylusHandwriting(msg.arg1, (InputChannel) args.arg1, Loading Loading @@ -400,6 +405,14 @@ class IInputMethodWrapper extends IInputMethod.Stub mCaller.obtainMessageI(DO_CAN_START_STYLUS_HANDWRITING, requestId)); } @BinderThread @Override public void updateEditorToolType(int toolType) throws RemoteException { mCaller.executeOrSendMessage( mCaller.obtainMessageI(DO_UPDATE_TOOL_TYPE, toolType)); } @BinderThread @Override public void startStylusHandwriting(int requestId, @NonNull InputChannel channel, Loading
core/java/android/inputmethodservice/InputMethodService.java +25 −0 Original line number Diff line number Diff line Loading @@ -948,6 +948,15 @@ public class InputMethodService extends AbstractInputMethodService { Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } /** * {@inheritDoc} * @hide */ @Override public void updateEditorToolType(int toolType) { onUpdateEditorToolType(toolType); } /** * {@inheritDoc} * @hide Loading Loading @@ -3012,17 +3021,33 @@ public class InputMethodService extends AbstractInputMethodService { * not call to inform the IME of this interaction. * @param focusChanged true if the user changed the focused view by this click. * @see InputMethodManager#viewClicked(View) * @see #onUpdateEditorToolType(int) * @deprecated The method may not be called for composite {@link View} that works as a giant * "Canvas", which can host its own UI hierarchy and sub focus state. * {@link android.webkit.WebView} is a good example. Application / IME developers * should not rely on this method. If your goal is just being notified when an * on-going input is interrupted, simply monitor {@link #onFinishInput()}. * If your goal is to know what {@link MotionEvent#getToolType(int)} clicked on * editor, use {@link #onUpdateEditorToolType(int)} instead. */ @Deprecated public void onViewClicked(boolean focusChanged) { // Intentionally empty } /** * Called when the user tapped or clicked an {@link android.widget.Editor}. * This can be useful when IME makes a decision of showing Virtual keyboard based on what * {@link MotionEvent#getToolType(int)} was used to click the editor. * e.g. when toolType is {@link MotionEvent#TOOL_TYPE_STYLUS}, IME may choose to show a * companion widget instead of normal virtual keyboard. * <p> Default implementation does nothing. </p> * @param toolType what {@link MotionEvent#getToolType(int)} was used to click on editor. */ public void onUpdateEditorToolType(int toolType) { // Intentionally empty } /** * Called when the application has reported a new location of its text * cursor. This is only called if explicitly requested by the input method. Loading
core/java/android/view/ViewRootImpl.java +16 −1 Original line number Diff line number Diff line Loading @@ -734,6 +734,8 @@ public final class ViewRootImpl implements ViewParent, final PointF mDragPoint = new PointF(); final PointF mLastTouchPoint = new PointF(); int mLastTouchSource; /** Tracks last {@link MotionEvent#getToolType(int)} with {@link MotionEvent#ACTION_UP}. **/ private int mLastClickToolType; private boolean mProfileRendering; private Choreographer.FrameCallback mRenderProfiler; Loading Loading @@ -6417,11 +6419,16 @@ public final class ViewRootImpl implements ViewParent, event.offsetLocation(0, mCurScrollY); } // Remember the touch position for possible drag-initiation. if (event.isTouchEvent()) { // Remember the touch position for possible drag-initiation. mLastTouchPoint.x = event.getRawX(); mLastTouchPoint.y = event.getRawY(); mLastTouchSource = event.getSource(); // Register last ACTION_UP. This will be propagated to IME. if (event.getActionMasked() == MotionEvent.ACTION_UP) { mLastClickToolType = event.getToolType(event.getActionIndex()); } } return FORWARD; } Loading Loading @@ -8017,6 +8024,14 @@ public final class ViewRootImpl implements ViewParent, return mLastTouchSource; } /** * Used by InputMethodManager. * @hide */ public int getLastClickToolType() { return mLastClickToolType; } public void setDragFocus(View newDragTarget, DragEvent event) { if (mCurrentDragView != newDragTarget && !View.sCascadedDragDrop) { // Send EXITED and ENTERED notifications to the old and new drag focus views. Loading
core/java/android/view/inputmethod/EditorInfo.java +37 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.content.res.Configuration; import android.inputmethodservice.InputMethodService; import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.LocaleList; Loading @@ -40,6 +41,7 @@ import android.text.InputType; import android.text.TextUtils; import android.util.Printer; import android.util.proto.ProtoOutputStream; import android.view.MotionEvent; import android.view.View; import android.view.autofill.AutofillId; Loading Loading @@ -564,6 +566,12 @@ public class EditorInfo implements InputType, Parcelable { @Nullable private SurroundingText mInitialSurroundingText = null; /** * Initial {@link MotionEvent#ACTION_UP} tool type {@link MotionEvent#getToolType(int)} that * was used to focus this editor. */ private int mInitialToolType = MotionEvent.TOOL_TYPE_UNKNOWN; /** * Editors may use this method to provide initial input text to IMEs. As the surrounding text Loading Loading @@ -936,6 +944,31 @@ public class EditorInfo implements InputType, Parcelable { } } /** * Returns the initial {@link MotionEvent#ACTION_UP} tool type * {@link MotionEvent#getToolType(int)} responsible for focus on the current editor. * * @see #setInitialToolType(int) * @see MotionEvent#getToolType(int) * @see InputMethodService#onUpdateEditorToolType(int) * @return toolType {@link MotionEvent#getToolType(int)}. */ public int getInitialToolType() { return mInitialToolType; } /** * Set the initial {@link MotionEvent#ACTION_UP} tool type {@link MotionEvent#getToolType(int)}. * that brought focus to the view. * * @see #getInitialToolType() * @see MotionEvent#getToolType(int) * @see InputMethodService#onUpdateEditorToolType(int) */ public void setInitialToolType(int toolType) { mInitialToolType = toolType; } /** * Export the state of {@link EditorInfo} into a protocol buffer output stream. * Loading Loading @@ -972,6 +1005,7 @@ public class EditorInfo implements InputType, Parcelable { + " actionId=" + actionId); pw.println(prefix + "initialSelStart=" + initialSelStart + " initialSelEnd=" + initialSelEnd + " initialToolType=" + mInitialToolType + " initialCapsMode=0x" + Integer.toHexString(initialCapsMode)); pw.println(prefix + "hintText=" + hintText Loading Loading @@ -1006,6 +1040,7 @@ public class EditorInfo implements InputType, Parcelable { newEditorInfo.initialSelStart = initialSelStart; newEditorInfo.initialSelEnd = initialSelEnd; newEditorInfo.initialCapsMode = initialCapsMode; newEditorInfo.mInitialToolType = mInitialToolType; newEditorInfo.hintText = TextUtils.stringOrSpannedString(hintText); newEditorInfo.label = TextUtils.stringOrSpannedString(label); newEditorInfo.packageName = packageName; Loading Loading @@ -1036,6 +1071,7 @@ public class EditorInfo implements InputType, Parcelable { dest.writeInt(initialSelStart); dest.writeInt(initialSelEnd); dest.writeInt(initialCapsMode); dest.writeInt(mInitialToolType); TextUtils.writeToParcel(hintText, dest, flags); TextUtils.writeToParcel(label, dest, flags); dest.writeString(packageName); Loading Loading @@ -1072,6 +1108,7 @@ public class EditorInfo implements InputType, Parcelable { res.initialSelStart = source.readInt(); res.initialSelEnd = source.readInt(); res.initialCapsMode = source.readInt(); res.mInitialToolType = source.readInt(); res.hintText = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); res.label = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); res.packageName = source.readString(); Loading