Clarify the purpose of EditorInfo#hintLocales.
During the initial attempt to support automatic language switching in
LatinIME, it turns out that the current EditorInfo#locales is difficult
to use and even confusing in some situations. Based on that
experience, this CL changes as follows:
* Rename EditorInfo#locales to EditorInfo#hintLocales:
This is mainly to avoid possible confusion when to set this. We want
to make it clear that having non-empty LocaleList there is a clear
signal that the user would switch to certain languages regardless of
the currently selected input method subtype.
* Make EditorInfo#hintLocales nullable:
Previously marshaling EditorInfor causes NPE when
EditorInfo#hintLocales is null. This CL relaxes such a restriction.
* Introduce TextView#{set, get}ImeHintLocales():
In the previous implementation [1], we just copied
TextView#getTextLocales() into EditorInfo. This is, however, does not
work well because it is no more or less than the default value. If
LatinIME supports automatic language switching, having the default
value in EditorInfo actually means that whenever you focus in a new
text field, the keyboard language is reset to the default locale.
In order to make this "hint" useful for IME developers, this "hint"
should be specified only when the application developers are confident
to do so.
[1]: I738ffaaf07091d8b980f8bfc6e16227fcb85a96a
0445fdf321e74044dc9f3719922fc8ff4923fdf4
Bug: 22859862
Change-Id: I0a730011874ea8d01e50624ed3f1ecd197d05f94
6 files changed