Simplify the constructor of InputMethodInfo

This is a preparation CL for fixing Bug 32343335, where we aim to
avoid unnecessary reconstruction of InputMethodInfo objects by caching
immutable part of those metadata by APK revisions.

The reason why we have had to pass additional subtypes not just as
List<InputMethodSubtype> but as Map<String, List<InputMethodSubtype>>
to create an instance of InputMethodInfo is that how to compute
so-called IME ID is not exposed from InputMethodInfo even as @hide
method.

In practice it has been calculated as
  new ComponentName(packageName, serviceName).flattenToShortString()
and those IDs are already stored here and there including secure
settings.  It is almost impossible to change the rule anymore hence
we should consider them to be a kind of public API.

This CL adds a @hide static method InputMethodInfo#computeId() to
make it clear.  This also enables us to simplify the constructor
of InputMethodInfo finally, because we have used IME IDs as keys
in subtypes.xml, where additional subtypes are stored.

Test: Manually verified that addtional subtypes still work
Test: checkbuild
Bug: 32343335
Change-Id: I1deaa470e042eac749e7a847933d14448a0d9e03
2 files changed