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

A unified data class to represent all the InputConnection call

This CL introduces a new parcelable class InputConnectionCommand so
that any of existing and future InputConnection APIs can be marshalled
into a standard Java object, which itself can be a subject of other
useful operations.

Historically each InputConnection API has had a corresponding IPC
definition in IInputContext binder interface, which is indeed a widely
used design pattern in the Android OS [1].  Instead of continuing
doing so, this CL reimplements everything by a single unified IPC
method with a single unified Parcelable data object existing and
future InputConnection APIs.  Although doing so would introduce some
complexity, it also gives us huge flexibility and opportunities to
abstract out common data structure and operations across all the
InputConnection API calls.

For instance, here are code snippets we can now simply write.

  ArrayList<InputConnectionCommand> pendingTasks;

  void dumpToProto(@NonNull InputConnectionCommand command) {
     ...
  }

  void cancelPendingTasks(Predicate<InputConnectionCommand> cond) {
    ...
  }

to do more complex abstractions as needed.

Other than rewriting InputConnection remote execution in a different
manner, this CL changes nothing.  There should be no developer/user
visible behavior changed in this CL, which can also be verified with
CtsInputMethodTestCases:InputConnectionEndToEndTest.

 [1]: This is not a hard requiement though. In fact there is already
      android.os.Messenger that has been used in several places in the
      system.  What android.os.Messenger does is semantically the same
      as what IInputConnectionWrapper is going to do with this CL.

Fix: 194151409
Test: atest CtsInputMethodTestCases:InputConnectionEndToEndTest
Test: atest FrameworksCoreTests:InputMethodDebugTest
Change-Id: I86eba7185b4b0664c1b0b3da794dfc5eeddc725c
parent 7a3500fb
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