diff options
| author | Yohei Yukawa <yukawa@google.com> | 2021-07-07 09:03:53 -0700 |
|---|---|---|
| committer | Yohei Yukawa <yukawa@google.com> | 2021-07-07 09:03:53 -0700 |
| commit | e6cd60da19f4af660d79ec849d5ae1ad2819a412 (patch) | |
| tree | ff7f2a475985dd1bb1b5e10f2cc1cb7c43a8e205 /core/java | |
| parent | 8426bd7d02cf249b86b2f1954c268e3b782773e3 (diff) | |
Clarify EditableInputConnection has a public alternative
This is a preparation to remove @UnsupportedAppUsage from the
constructor of a hidden class EditableInputConnection.
In most of cases, app developers should be using
android.view.inputmethod.InputConnectionWrapper
to intercept InputConnection API calls before they are delivered to
EditText as follows.
final EditText editText = new EditText(activity) {
@Override
public InputConnection onCreateInputConnection(
EditorInfo editorInfo) {
return new InputConnectionWrapper(
super.onCreateInputConnection(editorInfo), false) {
/**
* {@inheritDoc}
*/
@Override
public boolean commitText(
CharSequence text, int newCursorPosition) {
// do something
return super.commitText(text, newCursorPosition);
}
};
}
};
You can also re-implement BaseInputConnection without hidden APIs
since Android 9. See CLs that are associated with Bug 24688781 for
details.
This CL makes this fact clear for app developers by using
"publicAlternatives" field in @UnsupportedAppUsage.
Bug: 192969370
Test: presubmit
Change-Id: I0c879645a84fde14dd6444bb4735f543457e43a8
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/com/android/internal/widget/EditableInputConnection.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/java/com/android/internal/widget/EditableInputConnection.java b/core/java/com/android/internal/widget/EditableInputConnection.java index 02ffe8c5268e..54113c1c110a 100644 --- a/core/java/com/android/internal/widget/EditableInputConnection.java +++ b/core/java/com/android/internal/widget/EditableInputConnection.java @@ -55,7 +55,10 @@ public class EditableInputConnection extends BaseInputConnection // A negative value means that this connection has been finished by the InputMethodManager. private int mBatchEditNesting; - @UnsupportedAppUsage + @UnsupportedAppUsage(trackingBug = 192969370, + publicAlternatives = "Use {@link android.view.inputmethod.InputConnectionWrapper} to " + + "intercept method calls. Or directly implement " + + "{@link android.view.inputmethod.InputConnection} for your own editor.") public EditableInputConnection(TextView textview) { super(textview, true); mTextView = textview; |
