Add a utility method to filter locales.
This is a preparation CL to take secondary system locales into
account in InputMethodUtils#getImplicitlyApplicableSubtypesLocked().
Suppose the following situation:
available subtypes:
en-US, en-IN, and en-GB, fr, fr-CA, fr-CH, fr (QWERTZ)
system locales:
en-GB, en-US, fr-MC
Basically we want to have at most one subtype for each language appears
in system locales. Hence the goal of this utility method is to filter
the above available subtypes into en-GB and fr. In other word, we do
not want to enable both en-GB and en-US subtypes in this scenario.
This CL introduces LocaleUtils#filterByLanguage() for this purpose, with
some unit tests. Note that that method is not used in production yet.
Bug: 27129703
Change-Id: I315cf3722a06e00bdbfac284c4949578da8fe78d
2 files changed