Skip to content
Commit e6cd60da authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

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
parent 8426bd7d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment