OSDN Git Service

BaseInputConnection shouldn't rely on @hide APIs.
authorYohei Yukawa <yukawa@google.com>
Fri, 8 Jan 2016 00:52:33 +0000 (16:52 -0800)
committerYohei Yukawa <yukawa@google.com>
Fri, 8 Jan 2016 00:52:33 +0000 (16:52 -0800)
commit159dd47db34151314e2449347251ad32b30e5ea1
treecec66f17db3b860b29b6a55f0a2b18dcfea76004
parentba75a9b6bab16114a8206015a4d2c7ce3bd70f2a
BaseInputConnection shouldn't rely on @hide APIs.

This is a part of effort to reduce the number of dependencies on @hide
method in BaseInputConnection.

In a nutshell, IMM#notifyUserAction() and IMM#setFullscreenMode() are
something that IME developers should not care about, hence ideally
BaseInputConnection should not rely on them.

  IMM#setFullscreenMode():
    This @hide method is just for updating an internal state flag about
    whether the current IME is in full screen mode or not.

  IMM#notifyUserAction():
    This @hide methods is just for sending a signal to IMMS so that IME
    rotation list (for globe button) can be updated based on the user's
    action.

Depending on those @hide methods in BaseInputConnection is problematic
because:

  A. We cannot implement InputConnection without relying on
     BaseInputConnection, which forces developers to use Editable to
     maintain internal text representations.
  B. If BaseInputConnection#commitText is overridden,
     those @hide method calls can be missed.
  C. Currently some method calls of BaseInputConnection() even from
     application itself can trigger those @hide method calls.  Ideally
     those internal events can be dispatched only when those methods are
     called from the input method rather than the application itself.

With this CL, those @hide API calls will be moved from
BaseInputConnection to ControlledInputConnectionWrapper so that
developers can forget about them.

Note that BaseInputConnection#sendKeyEvent() still relies on @hide
internal details of IMM.  It should be addressed in a subsequent CL.

Bug: 24688781
Change-Id: I571d6cc9c6e461d8994aa7496e7e18be13766411
core/java/android/view/inputmethod/BaseInputConnection.java
core/java/android/view/inputmethod/InputMethodManager.java
core/java/com/android/internal/view/IInputConnectionWrapper.java