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

Add a new Binder interface to allow IMS to directly talk to IMMS

Historically, InputMethodService (IMS) has relied on
InputMethodManager's hidden methods to communicate with
InputMethodManagerService (IMMS).  Because of this, InputMethodManager
(IMM) has ended up being a mixture of IPC endpoint for both IME
clients and IME itself.

There are multiple problems.

 * IMM is instantiated in almost all user mode processes.  This means
   that unnecessary IPC endpoints have been accessible to them via
   reflection.  Even though those endpoints refuses request without a
   valid IME window token, and even though we have tighten up use of
   private APIs in the runtime level, exposing unnecessary IPC
   endpoints is still questionable.
 * Mixing multiple responsibilities has been caused unnecessary
   complexity in IMM.  In Bug 70282603, we have moved some APIs from
   IMM to IMS to sort out this complexity that are surfaced in API
   boundary, but in the implementation level everything remained to be
   the same.

Now that Bug 70282603 is fixed, the natural next step is to start
implementing actual an IPC connection from IMS to IMMS without relying
on IMM.

Here is the new diagram that describes (most of) IPC interfaces around
IMEs.

   APP---(1)---IMMS
     \          |
      \         |
       \        |
        \       |
         \      |
         (2)   (3)
           \    |
            \   |
             \  |
              \ |
               \|
               IME

 (1): IInputMethodManager.aidl: send requests from APP to IMMS
      IInputMethodClient.aidl:  send requests from IMMS to APP
 (2): IInputMethodSession.aidl: send requests from APP to IME
      IInputContext.aidl:       send requests from IME to APP
       -> this is the actual interface behind InputConnection
 (3): IInputMethod.aidl:        send requests from IMMS to IME
      IInputMethodPrivilegedOperations.aidl:
                                send requests from IME to IMMS

IInputMethodPrivilegedOperations.aidl is what this CL is adding.

With that, this CL moves 5 IPC methods
  from IInputMethodManager.aidl (1)
  to IInputMethodPrivilegedOperations.aidl (3).

There remain some IPC methods that are intended to be used only from
IMEs in IInputMethodManager.aidl because those methods have been
unfortunately exposed via public APIs in InputMethodmanager.

Although all of those public APIs were deprecated in Android P as part
of Bug 70282603, we still need to keep maintaining those APIs until
(most of) IMEs migrate to APIs that are newly introduced in
InputMethodService.  It would take several years.

IInputMethodManager#getInputMethodWindowVisibleHeight() is another
method that we cannot migrate right now because some apps have already
relied on its corresponding hidden method in IMM, as discussed in Bug
113914148.

Fix: 113177698
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Change-Id: I2f3ec3c5de546fb3603275a4b64000ed3f863b65
parent cf7039dc
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