Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -49587,6 +49587,7 @@ package android.view.inputmethod { method public abstract boolean performEditorAction(int); method public abstract boolean performPrivateCommand(java.lang.String, android.os.Bundle); method public abstract boolean reportFullscreenMode(boolean); method public default void reportLanguageHint(android.os.LocaleList); method public abstract boolean requestCursorUpdates(int); method public abstract boolean sendKeyEvent(android.view.KeyEvent); method public abstract boolean setComposingRegion(int, int); core/java/android/view/inputmethod/InputConnection.java +34 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.annotation.Nullable; import android.inputmethodservice.InputMethodService; import android.os.Bundle; import android.os.Handler; import android.os.LocaleList; import android.view.KeyCharacterMap; import android.view.KeyEvent; Loading Loading @@ -898,4 +899,37 @@ public interface InputConnection { */ boolean commitContent(@NonNull InputContentInfo inputContentInfo, int flags, @Nullable Bundle opts); /** * Called by the input method to tell a hint about the locales of text to be committed. * * <p>This is just a hint for editor authors (and the system) to choose better options when * they have to disambiguate languages, like editor authors can do for input methods with * {@link EditorInfo#hintLocales}.</p> * * <p>The language hint provided by this callback should have higher priority than * {@link InputMethodSubtype#getLanguageTag()}, which cannot be updated dynamically.</p> * * <p>Note that in general it is discouraged for input method to specify * {@link android.text.style.LocaleSpan} when inputting text, mainly because of application * compatibility concerns.</p> * <ul> * <li>When an existing text that already has {@link android.text.style.LocaleSpan} is being * modified by both the input method and application, there is no reliable and easy way to * keep track of who modified {@link android.text.style.LocaleSpan}. For instance, if the * text was updated by JavaScript, it it highly likely that span information is completely * removed, while some input method attempts to preserve spans if possible.</li> * <li>There is no clear semantics regarding whether {@link android.text.style.LocaleSpan} * means a weak (ignorable) hint or a strong hint. This becomes more problematic when * multiple {@link android.text.style.LocaleSpan} instances are specified to the same * text region, especially when those spans are conflicting.</li> * </ul> * @param languageHint list of languages sorted by the priority and/or probability */ default void reportLanguageHint(@NonNull LocaleList languageHint) { // Intentionally empty. // // We need to have *some* default implementation for the source compatibility. // See Bug 72127682 for details. } } core/java/android/view/inputmethod/InputConnectionWrapper.java +11 −0 Original line number Diff line number Diff line Loading @@ -16,8 +16,10 @@ package android.view.inputmethod; import android.annotation.NonNull; import android.os.Bundle; import android.os.Handler; import android.os.LocaleList; import android.view.KeyEvent; /** Loading Loading @@ -303,4 +305,13 @@ public class InputConnectionWrapper implements InputConnection { public boolean commitContent(InputContentInfo inputContentInfo, int flags, Bundle opts) { return mTarget.commitContent(inputContentInfo, flags, opts); } /** * {@inheritDoc} * @throws NullPointerException if the target is {@code null}. */ @Override public void reportLanguageHint(@NonNull LocaleList languageHint) { mTarget.reportLanguageHint(languageHint); } } core/java/android/widget/AbsListView.java +6 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.graphics.drawable.TransitionDrawable; import android.os.Bundle; import android.os.Debug; import android.os.Handler; import android.os.LocaleList; import android.os.Parcel; import android.os.Parcelable; import android.os.StrictMode; Loading Loading @@ -6035,6 +6036,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te public boolean commitContent(InputContentInfo inputContentInfo, int flags, Bundle opts) { return getTarget().commitContent(inputContentInfo, flags, opts); } @Override public void reportLanguageHint(@NonNull LocaleList languageHint) { getTarget().reportLanguageHint(languageHint); } } /** Loading core/java/com/android/internal/view/IInputConnectionWrapper.java +16 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Bundle; import android.os.Handler; import android.os.LocaleList; import android.os.Looper; import android.os.Message; import android.os.RemoteException; Loading Loading @@ -64,6 +65,7 @@ public abstract class IInputConnectionWrapper extends IInputContext.Stub { private static final int DO_REQUEST_UPDATE_CURSOR_ANCHOR_INFO = 140; private static final int DO_CLOSE_CONNECTION = 150; private static final int DO_COMMIT_CONTENT = 160; private static final int DO_REPORT_LANGUAGE_HINT = 170; @GuardedBy("mLock") @Nullable Loading Loading @@ -217,6 +219,10 @@ public abstract class IInputConnectionWrapper extends IInputContext.Stub { callback)); } public void reportLanguageHint(@NonNull LocaleList languageHint) { dispatchMessage(obtainMessageO(DO_REPORT_LANGUAGE_HINT, languageHint)); } void dispatchMessage(Message msg) { // If we are calling this from the main thread, then we can call // right through. Otherwise, we need to send the message to the Loading Loading @@ -577,6 +583,16 @@ public abstract class IInputConnectionWrapper extends IInputContext.Stub { } return; } case DO_REPORT_LANGUAGE_HINT: { final LocaleList languageHint = (LocaleList) msg.obj; final InputConnection ic = getInputConnection(); if (ic == null || !isActive()) { Log.w(TAG, "reportLanguageHint on inactive InputConnection"); return; } ic.reportLanguageHint(languageHint); return; } } Log.w(TAG, "Unhandled message code: " + msg.what); } Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -49587,6 +49587,7 @@ package android.view.inputmethod { method public abstract boolean performEditorAction(int); method public abstract boolean performPrivateCommand(java.lang.String, android.os.Bundle); method public abstract boolean reportFullscreenMode(boolean); method public default void reportLanguageHint(android.os.LocaleList); method public abstract boolean requestCursorUpdates(int); method public abstract boolean sendKeyEvent(android.view.KeyEvent); method public abstract boolean setComposingRegion(int, int);
core/java/android/view/inputmethod/InputConnection.java +34 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.annotation.Nullable; import android.inputmethodservice.InputMethodService; import android.os.Bundle; import android.os.Handler; import android.os.LocaleList; import android.view.KeyCharacterMap; import android.view.KeyEvent; Loading Loading @@ -898,4 +899,37 @@ public interface InputConnection { */ boolean commitContent(@NonNull InputContentInfo inputContentInfo, int flags, @Nullable Bundle opts); /** * Called by the input method to tell a hint about the locales of text to be committed. * * <p>This is just a hint for editor authors (and the system) to choose better options when * they have to disambiguate languages, like editor authors can do for input methods with * {@link EditorInfo#hintLocales}.</p> * * <p>The language hint provided by this callback should have higher priority than * {@link InputMethodSubtype#getLanguageTag()}, which cannot be updated dynamically.</p> * * <p>Note that in general it is discouraged for input method to specify * {@link android.text.style.LocaleSpan} when inputting text, mainly because of application * compatibility concerns.</p> * <ul> * <li>When an existing text that already has {@link android.text.style.LocaleSpan} is being * modified by both the input method and application, there is no reliable and easy way to * keep track of who modified {@link android.text.style.LocaleSpan}. For instance, if the * text was updated by JavaScript, it it highly likely that span information is completely * removed, while some input method attempts to preserve spans if possible.</li> * <li>There is no clear semantics regarding whether {@link android.text.style.LocaleSpan} * means a weak (ignorable) hint or a strong hint. This becomes more problematic when * multiple {@link android.text.style.LocaleSpan} instances are specified to the same * text region, especially when those spans are conflicting.</li> * </ul> * @param languageHint list of languages sorted by the priority and/or probability */ default void reportLanguageHint(@NonNull LocaleList languageHint) { // Intentionally empty. // // We need to have *some* default implementation for the source compatibility. // See Bug 72127682 for details. } }
core/java/android/view/inputmethod/InputConnectionWrapper.java +11 −0 Original line number Diff line number Diff line Loading @@ -16,8 +16,10 @@ package android.view.inputmethod; import android.annotation.NonNull; import android.os.Bundle; import android.os.Handler; import android.os.LocaleList; import android.view.KeyEvent; /** Loading Loading @@ -303,4 +305,13 @@ public class InputConnectionWrapper implements InputConnection { public boolean commitContent(InputContentInfo inputContentInfo, int flags, Bundle opts) { return mTarget.commitContent(inputContentInfo, flags, opts); } /** * {@inheritDoc} * @throws NullPointerException if the target is {@code null}. */ @Override public void reportLanguageHint(@NonNull LocaleList languageHint) { mTarget.reportLanguageHint(languageHint); } }
core/java/android/widget/AbsListView.java +6 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.graphics.drawable.TransitionDrawable; import android.os.Bundle; import android.os.Debug; import android.os.Handler; import android.os.LocaleList; import android.os.Parcel; import android.os.Parcelable; import android.os.StrictMode; Loading Loading @@ -6035,6 +6036,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te public boolean commitContent(InputContentInfo inputContentInfo, int flags, Bundle opts) { return getTarget().commitContent(inputContentInfo, flags, opts); } @Override public void reportLanguageHint(@NonNull LocaleList languageHint) { getTarget().reportLanguageHint(languageHint); } } /** Loading
core/java/com/android/internal/view/IInputConnectionWrapper.java +16 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Bundle; import android.os.Handler; import android.os.LocaleList; import android.os.Looper; import android.os.Message; import android.os.RemoteException; Loading Loading @@ -64,6 +65,7 @@ public abstract class IInputConnectionWrapper extends IInputContext.Stub { private static final int DO_REQUEST_UPDATE_CURSOR_ANCHOR_INFO = 140; private static final int DO_CLOSE_CONNECTION = 150; private static final int DO_COMMIT_CONTENT = 160; private static final int DO_REPORT_LANGUAGE_HINT = 170; @GuardedBy("mLock") @Nullable Loading Loading @@ -217,6 +219,10 @@ public abstract class IInputConnectionWrapper extends IInputContext.Stub { callback)); } public void reportLanguageHint(@NonNull LocaleList languageHint) { dispatchMessage(obtainMessageO(DO_REPORT_LANGUAGE_HINT, languageHint)); } void dispatchMessage(Message msg) { // If we are calling this from the main thread, then we can call // right through. Otherwise, we need to send the message to the Loading Loading @@ -577,6 +583,16 @@ public abstract class IInputConnectionWrapper extends IInputContext.Stub { } return; } case DO_REPORT_LANGUAGE_HINT: { final LocaleList languageHint = (LocaleList) msg.obj; final InputConnection ic = getInputConnection(); if (ic == null || !isActive()) { Log.w(TAG, "reportLanguageHint on inactive InputConnection"); return; } ic.reportLanguageHint(languageHint); return; } } Log.w(TAG, "Unhandled message code: " + msg.what); } Loading