diff --git a/api/current.txt b/api/current.txt index 5607d08af5968..60668bab854fb 100644 --- a/api/current.txt +++ b/api/current.txt @@ -35798,7 +35798,7 @@ package android.view.inputmethod { method public boolean performPrivateCommand(java.lang.String, android.os.Bundle); method public static final void removeComposingSpans(android.text.Spannable); method public boolean reportFullscreenMode(boolean); - method public boolean requestUpdateCursorAnchorInfo(int); + method public boolean requestCursorUpdates(int); method public boolean sendKeyEvent(android.view.KeyEvent); method public boolean setComposingRegion(int, int); method public static void setComposingSpans(android.text.Spannable); @@ -35957,15 +35957,15 @@ 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 abstract boolean requestUpdateCursorAnchorInfo(int); + method public abstract boolean requestCursorUpdates(int); method public abstract boolean sendKeyEvent(android.view.KeyEvent); method public abstract boolean setComposingRegion(int, int); method public abstract boolean setComposingText(java.lang.CharSequence, int); method public abstract boolean setSelection(int, int); + 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 field public static final int GET_TEXT_WITH_STYLES = 1; // 0x1 - field public static final int REQUEST_UPDATE_CURSOR_ANCHOR_INFO_IMMEDIATE = 1; // 0x1 - field public static final int REQUEST_UPDATE_CURSOR_ANCHOR_INFO_MONITOR = 2; // 0x2 } public class InputConnectionWrapper implements android.view.inputmethod.InputConnection { @@ -35987,7 +35987,7 @@ package android.view.inputmethod { method public boolean performEditorAction(int); method public boolean performPrivateCommand(java.lang.String, android.os.Bundle); method public boolean reportFullscreenMode(boolean); - method public boolean requestUpdateCursorAnchorInfo(int); + method public boolean requestCursorUpdates(int); method public boolean sendKeyEvent(android.view.KeyEvent); method public boolean setComposingRegion(int, int); method public boolean setComposingText(java.lang.CharSequence, int); diff --git a/api/removed.txt b/api/removed.txt index 36f8920a681dd..a910e7864fa66 100644 --- a/api/removed.txt +++ b/api/removed.txt @@ -50,6 +50,10 @@ package android.view { package android.view.inputmethod { + public class BaseInputConnection implements android.view.inputmethod.InputConnection { + method public final boolean requestUpdateCursorAnchorInfo(int); + } + public final class CursorAnchorInfo implements android.os.Parcelable { method public boolean isInsertionMarkerClipped(); field public static final int CHARACTER_RECT_TYPE_FULLY_VISIBLE = 1; // 0x1 @@ -64,6 +68,16 @@ package android.view.inputmethod { method public android.view.inputmethod.CursorAnchorInfo.Builder setInsertionMarkerLocation(float, float, float, float, boolean); } + public abstract interface InputConnection { + method public abstract boolean requestUpdateCursorAnchorInfo(int); + field public static final int REQUEST_UPDATE_CURSOR_ANCHOR_INFO_MONITOR = 2; // 0x2 + field public static final int REQUEST_UPDATE_CURSOR_UPDATE_IMMEDIATE = 1; // 0x1 + } + + public class InputConnectionWrapper implements android.view.inputmethod.InputConnection { + method public final boolean requestUpdateCursorAnchorInfo(int); + } + } package com.android.internal { diff --git a/core/java/android/view/inputmethod/BaseInputConnection.java b/core/java/android/view/inputmethod/BaseInputConnection.java index 4d2f57a7a2fc2..20adfe426ef2e 100644 --- a/core/java/android/view/inputmethod/BaseInputConnection.java +++ b/core/java/android/view/inputmethod/BaseInputConnection.java @@ -431,7 +431,15 @@ public class BaseInputConnection implements InputConnection { /** * The default implementation does nothing. */ - public boolean requestUpdateCursorAnchorInfo(int cursorUpdateMode) { + public boolean requestCursorUpdates(int cursorUpdateMode) { + return false; + } + + /** + * The default implementation does nothing. + * @removed + */ + public final boolean requestUpdateCursorAnchorInfo(int cursorUpdateMode) { return false; } diff --git a/core/java/android/view/inputmethod/InputConnection.java b/core/java/android/view/inputmethod/InputConnection.java index ca094c1fa0a8a..093fb2fbc098b 100644 --- a/core/java/android/view/inputmethod/InputConnection.java +++ b/core/java/android/view/inputmethod/InputConnection.java @@ -728,31 +728,47 @@ public interface InputConnection { * The editor is requested to call * {@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 #REQUEST_UPDATE_CURSOR_ANCHOR_INFO_MONITOR}. + * used together with {@link #CURSOR_UPDATE_MONITOR}. */ - public static final int REQUEST_UPDATE_CURSOR_ANCHOR_INFO_IMMEDIATE = 1 << 0; + public static final int CURSOR_UPDATE_IMMEDIATE = 1 << 0; /** * The editor is requested to call * {@link InputMethodManager#updateCursorAnchorInfo(android.view.View, CursorAnchorInfo)} * whenever cursor/anchor position is changed. To disable monitoring, call - * {@link InputConnection#requestUpdateCursorAnchorInfo(int)} again with this flag off. + * {@link InputConnection#requestCursorUpdates(int)} again with this flag off. *
- * This flag can be used together with {@link #REQUEST_UPDATE_CURSOR_ANCHOR_INFO_IMMEDIATE}. + * This flag can be used together with {@link #CURSOR_UPDATE_IMMEDIATE}. *
*/ - public static final int REQUEST_UPDATE_CURSOR_ANCHOR_INFO_MONITOR = 1 << 1; + public static final int CURSOR_UPDATE_MONITOR = 1 << 1; /** * 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 #REQUEST_UPDATE_CURSOR_ANCHOR_INFO_IMMEDIATE} and/or - * {@link #REQUEST_UPDATE_CURSOR_ANCHOR_INFO_MONITOR} + * @param cursorUpdateMode {@link #CURSOR_UPDATE_IMMEDIATE} and/or + * {@link #CURSOR_UPDATE_MONITOR}. Pass {@code 0} to disable the effect of + * {@link #CURSOR_UPDATE_MONITOR}. * @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)}. */ + public boolean requestCursorUpdates(int cursorUpdateMode); + + /** + * @removed + */ + public static final int REQUEST_UPDATE_CURSOR_UPDATE_IMMEDIATE = 1 << 0; + + /** + * @removed + */ + public static final int REQUEST_UPDATE_CURSOR_ANCHOR_INFO_MONITOR = 1 << 1; + + /** + * @removed + */ public boolean requestUpdateCursorAnchorInfo(int cursorUpdateMode); } diff --git a/core/java/android/view/inputmethod/InputConnectionWrapper.java b/core/java/android/view/inputmethod/InputConnectionWrapper.java index d95df25e7b94b..87853deb98d38 100644 --- a/core/java/android/view/inputmethod/InputConnectionWrapper.java +++ b/core/java/android/view/inputmethod/InputConnectionWrapper.java @@ -126,7 +126,14 @@ public class InputConnectionWrapper implements InputConnection { return mTarget.performPrivateCommand(action, data); } - public boolean requestUpdateCursorAnchorInfo(int cursorUpdateMode) { - return mTarget.requestUpdateCursorAnchorInfo(cursorUpdateMode); + public boolean requestCursorUpdates(int cursorUpdateMode) { + return mTarget.requestCursorUpdates(cursorUpdateMode); } - } + + /** + * @removed + */ + public final boolean requestUpdateCursorAnchorInfo(int cursorUpdateMode) { + return mTarget.requestCursorUpdates(cursorUpdateMode); + } +} diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 0a472c73e7267..b56378fe6310c 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -1526,7 +1526,7 @@ public final class InputMethodManager { * Return true if the current input method wants to watch the location * of the input editor's cursor in its window. * - * @deprecated Use {@link InputConnection#requestUpdateCursorAnchorInfo(int)} instead. + * @deprecated Use {@link InputConnection#requestCursorUpdates(int)} instead. */ @Deprecated public boolean isWatchingCursor(View view) { @@ -1542,9 +1542,9 @@ public final class InputMethodManager { public boolean isCursorAnchorInfoEnabled() { synchronized (mH) { final boolean isImmediate = (mRequestUpdateCursorAnchorInfoMonitorMode & - InputConnection.REQUEST_UPDATE_CURSOR_ANCHOR_INFO_IMMEDIATE) != 0; + InputConnection.CURSOR_UPDATE_IMMEDIATE) != 0; final boolean isMonitoring = (mRequestUpdateCursorAnchorInfoMonitorMode & - InputConnection.REQUEST_UPDATE_CURSOR_ANCHOR_INFO_MONITOR) != 0; + InputConnection.CURSOR_UPDATE_MONITOR) != 0; return isImmediate || isMonitoring; } } @@ -1608,7 +1608,7 @@ public final class InputMethodManager { // If immediate bit is set, we will call updateCursorAnchorInfo() even when the data has // not been changed from the previous call. final boolean isImmediate = (mRequestUpdateCursorAnchorInfoMonitorMode & - InputConnection.REQUEST_UPDATE_CURSOR_ANCHOR_INFO_IMMEDIATE) != 0; + InputConnection.CURSOR_UPDATE_IMMEDIATE) != 0; if (!isImmediate && Objects.equals(mCursorAnchorInfo, cursorAnchorInfo)) { // TODO: Consider always emitting this message once we have addressed redundant // calls of this method from android.widget.Editor. @@ -1624,7 +1624,7 @@ public final class InputMethodManager { mCursorAnchorInfo = cursorAnchorInfo; // Clear immediate bit (if any). mRequestUpdateCursorAnchorInfoMonitorMode &= - ~InputConnection.REQUEST_UPDATE_CURSOR_ANCHOR_INFO_IMMEDIATE; + ~InputConnection.CURSOR_UPDATE_IMMEDIATE; } catch (RemoteException e) { Log.w(TAG, "IME died: " + mCurId, e); } diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 012a6aa00a5ca..026cfc19d3f34 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -5718,9 +5718,17 @@ public abstract class AbsListView extends AdapterView