diff options
author | Yohei Yukawa <yukawa@google.com> | 2014-09-03 14:35:32 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-09-03 14:35:32 +0000 |
commit | 8bb3b4331c9ce1f76fe003a70e05d6991808eafe (patch) | |
tree | aa0715b63f64ae513e5825cd48dd9779d720edf7 | |
parent | 0c2c72295cc9ae919ac7fb9fcb8b8fd96ddc3fa6 (diff) | |
parent | 5cde20020124286391e45ab386d531f9a7f00140 (diff) | |
download | frameworks_base-8bb3b4331c9ce1f76fe003a70e05d6991808eafe.zip frameworks_base-8bb3b4331c9ce1f76fe003a70e05d6991808eafe.tar.gz frameworks_base-8bb3b4331c9ce1f76fe003a70e05d6991808eafe.tar.bz2 |
am d88a1f97: am ebb6b422: Merge "API Review: InputConnection" into lmp-dev
* commit 'd88a1f9790bfaaa6540f65d76827274d716a2539':
API Review: InputConnection
-rw-r--r-- | api/current.txt | 10 | ||||
-rw-r--r-- | api/removed.txt | 14 | ||||
-rw-r--r-- | core/java/android/view/inputmethod/BaseInputConnection.java | 10 | ||||
-rw-r--r-- | core/java/android/view/inputmethod/InputConnection.java | 30 | ||||
-rw-r--r-- | core/java/android/view/inputmethod/InputConnectionWrapper.java | 13 | ||||
-rw-r--r-- | core/java/android/view/inputmethod/InputMethodManager.java | 10 | ||||
-rw-r--r-- | core/java/android/widget/AbsListView.java | 10 | ||||
-rw-r--r-- | core/java/com/android/internal/view/IInputConnectionWrapper.java | 2 | ||||
-rw-r--r-- | core/java/com/android/internal/view/InputConnectionWrapper.java | 9 | ||||
-rw-r--r-- | core/java/com/android/internal/widget/EditableInputConnection.java | 8 |
10 files changed, 88 insertions, 28 deletions
diff --git a/api/current.txt b/api/current.txt index 5607d08..60668ba 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 36f8920..a910e78 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 4d2f57a..20adfe4 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 ca094c1..093fb2f 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. * <p> - * 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}. * </p> */ - 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 d95df25..87853de 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 0a472c7..b56378f 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 012a6aa0..026cfc1 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -5719,8 +5719,16 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } @Override + public boolean requestCursorUpdates(int cursorUpdateMode) { + return getTarget().requestCursorUpdates(cursorUpdateMode); + } + + /** + * @removed + */ + @Override public boolean requestUpdateCursorAnchorInfo(int cursorUpdateMode) { - return getTarget().requestUpdateCursorAnchorInfo(cursorUpdateMode); + return getTarget().requestCursorUpdates(cursorUpdateMode); } } diff --git a/core/java/com/android/internal/view/IInputConnectionWrapper.java b/core/java/com/android/internal/view/IInputConnectionWrapper.java index b1f5d90..e19b2b6 100644 --- a/core/java/com/android/internal/view/IInputConnectionWrapper.java +++ b/core/java/com/android/internal/view/IInputConnectionWrapper.java @@ -437,7 +437,7 @@ public class IInputConnectionWrapper extends IInputContext.Stub { return; } args.callback.setRequestUpdateCursorAnchorInfoResult( - ic.requestUpdateCursorAnchorInfo(msg.arg1), args.seq); + ic.requestCursorUpdates(msg.arg1), args.seq); } catch (RemoteException e) { Log.w(TAG, "Got RemoteException calling requestCursorAnchorInfo", e); } diff --git a/core/java/com/android/internal/view/InputConnectionWrapper.java b/core/java/com/android/internal/view/InputConnectionWrapper.java index a8526c8..0c65ad1 100644 --- a/core/java/com/android/internal/view/InputConnectionWrapper.java +++ b/core/java/com/android/internal/view/InputConnectionWrapper.java @@ -428,7 +428,7 @@ public class InputConnectionWrapper implements InputConnection { } } - public boolean requestUpdateCursorAnchorInfo(int cursorUpdateMode) { + public boolean requestCursorUpdates(int cursorUpdateMode) { boolean result = false; try { InputContextCallback callback = InputContextCallback.getInstance(); @@ -445,4 +445,11 @@ public class InputConnectionWrapper implements InputConnection { } return result; } + + /** + * @removed + */ + public boolean requestUpdateCursorAnchorInfo(int cursorUpdateMode) { + return requestCursorUpdates(cursorUpdateMode); + } } diff --git a/core/java/com/android/internal/widget/EditableInputConnection.java b/core/java/com/android/internal/widget/EditableInputConnection.java index ba236f3..f211ff2 100644 --- a/core/java/com/android/internal/widget/EditableInputConnection.java +++ b/core/java/com/android/internal/widget/EditableInputConnection.java @@ -188,13 +188,13 @@ public class EditableInputConnection extends BaseInputConnection { } @Override - public boolean requestUpdateCursorAnchorInfo(int cursorUpdateMode) { + public boolean requestCursorUpdates(int cursorUpdateMode) { if (DEBUG) Log.v(TAG, "requestUpdateCursorAnchorInfo " + cursorUpdateMode); // It is possible that any other bit is used as a valid flag in a future release. // We should reject the entire request in such a case. - final int KNOWN_FLAGS_MASK = InputConnection.REQUEST_UPDATE_CURSOR_ANCHOR_INFO_IMMEDIATE | - InputConnection.REQUEST_UPDATE_CURSOR_ANCHOR_INFO_MONITOR; + final int KNOWN_FLAGS_MASK = InputConnection.CURSOR_UPDATE_IMMEDIATE | + InputConnection.CURSOR_UPDATE_MONITOR; final int unknownFlags = cursorUpdateMode & ~KNOWN_FLAGS_MASK; if (unknownFlags != 0) { if (DEBUG) { @@ -212,7 +212,7 @@ public class EditableInputConnection extends BaseInputConnection { return false; } mIMM.setUpdateCursorAnchorInfoMode(cursorUpdateMode); - if ((cursorUpdateMode & InputConnection.REQUEST_UPDATE_CURSOR_ANCHOR_INFO_IMMEDIATE) != 0) { + if ((cursorUpdateMode & InputConnection.CURSOR_UPDATE_IMMEDIATE) != 0) { if (mTextView == null) { // In this case, FLAG_CURSOR_ANCHOR_INFO_IMMEDIATE is silently ignored. // TODO: Return some notification code for the input method that indicates |