Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

Re-work IMM#getShortcutInputMethodsAndSubtypes()

It seems that InputMethodManager#getShortcutInputMethodsAndSubtypes()
was designed to be a bit more generalized concept, but in reality it
just ended up being a convenient API that returns a single Voice IME
subtype if exists.  As far as we can tell, It has never returned two
or mode pairs.  It also has never returned non-voice
InputMethodSubtype.

In order to support per-profile IME mode in InputMethodManagerService
without introducing a bunch of new complexity and technical debt, this
CL re-implements IMM#getShortcutInputMethodsAndSubtypes() based on how
it has been used actually in the ecosystem.

The first thing this CL changes is that
IMM#getShortcutInputMethodsAndSubtypes() no longer takes subtype
locale into account when looking for the best voice IME subtype. This
is because InputMethodSubtype is no longer a recommended way to
represent IME languages.  Ignoring subtype locale makes the
implementation much easier to understand and maintain.

The second thing this CL changes is that
IMM#getShortcutInputMethodsAndSubtypes() is now just a utility method
that is implemented in the client side on top of other well-defined
public APIs such as IMM#getEnabledInputMethodList() and
IMM#getEnabledInputMethodSubtypeList().  This means that this API
becomes per-profile IME ready for free once other public APIs become
per-profile IME ready.

 [1]: Ibd0f7ef5101013569c303820a3adc9038a97356d
      4e4569da

Bug: 120709962
Test: AOSP Keyboard still shows voice IME shortcut when the device has
      one or more IMEs that expose voice InputMethodSubtype.
Change-Id: Iaf31e9f3213f4e644b64c9658f1b59d371e3c2b4
parent 86e2377a
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