History log of /frameworks/base/core/java/android/view/textservice/SpellCheckerSubtype.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ad150ee271d9a0d27289407bd023924e23ec2b26 17-Mar-2016 Yohei Yukawa <yukawa@google.com> Remove an unnecessary int to String conversion.

This is a safe refactoring to remove an unnecessary int to String
conversion in TextServicesSettings.

Settings.Secure.SELECTED_SPELL_CHECKER_SUBTYPE is a integer value that
indicates subtype ID (or SpellCheckerSubtype#hashCode() if the subtype
ID is not specified), and we can just rely on
Settings.Secure#putIntForUser() rather than converting int to String
by ourselves then pass it to Settings.Secure#putStringForUser().

Note that this change is still OK for existing users because
Settings.Secure#putIntForUser() has been internally doing exactly the
same thing.

Bug: 27687531
Change-Id: Ibcf12746f1295c12bec095300ea7f6ced0a51d09
/frameworks/base/core/java/android/view/textservice/SpellCheckerSubtype.java
868d19b93b1e20c802a001c7304f8bcac5fe5114 08-Dec-2015 Yohei Yukawa <yukawa@google.com> Use BCP-47 LanguageTag in IME/Spell-Checker.

The primary goal of this CL is to make it clear that BCP-47 is the
expected format to annotate locale information for each
{InputMethod, SpellCkecker}Subtype. In order to avoid possible
compatibility issues, this CL introduce a new "languageTag" attribute
instead of reusing existing "imeSubtypeMode" and "subtypeLocale"
attributes.

For IME developers, this CL changes nothing unless "languageTag"
attribute is specified. To summarize:

A: If only legacy locale-string is specified
(existing IMEs/Spell-Checkers fall into this category):
-> The system uses locale-string.

B: If only LanguageTag is specified:
-> The system uses LanguageTag.

C: If both locale-string and languageTag are specified:
-> The system uses LanguageTag. Legacy locale-string is ignored.

For application developers, there should be some follow-ups CLs because
even with this CL most likely they would still have to take care of
previous versions of Android where:
- Locale#forLanguageTag() (N/A in API Level 20 and prior)
- Locale#toLanguageTag() (N/A in API Level 20 and prior)
- InputMethodSubtype#getLocale() (Deprecated in N)
- SpellCheckerSubtype#getLocale() (Deprecated in N)
- InputMethodSubtype#getLanguageTag() (N/A in M and prior)
- SpellCheckerSubtype#getLanguageTag() (N/A in M and prior)
One idea would be is in the official support library to provide a utility
method that takes care of above tasks and just returns a Locale object.
If we had a utility method in the support library, probably not
returning a Locale object from #getLanguageTag() would make sense.

From performance point of view both existing legacy locale-string
attribute and new LanguageTag attribute are just String objects that
travel from XML manifest to system services to applications via IPCs.
Hence there are no performance implications except for having one more
String objects.

Bug: 22858221
Change-Id: I6db107ad2afc7709167f7c4e5d24bd589ac8bd70
/frameworks/base/core/java/android/view/textservice/SpellCheckerSubtype.java
0894319162a2a1f4260805938d4807c4ffcbcb0f 05-Dec-2015 Yohei Yukawa <yukawa@google.com> Add subtypeId for SpellCheckerSubtype.

What this CL actually does is just copying the existing concept
"subtypeId" from InputMethodSubtype to SpellCheckerSubtype.

To recap, the underlying problem is that the system has stored only the
return value of SpellCheckerSubtype#hashCode() to track the set of
enabled subtypes, and SpellCheckerSubtype#hashCode() has been
implemented as Arrays.hashCode(new Object[] {locale, extraValue}), which
is problematic because:
- Spell checker developers cannot change "locale" and/or 'extraValue'
if they want to keep enabled subtypes enabled.
- Android Framework developers cannot change the hash function even
when new fields are added if they want to keep enabled subtypes
enabled.
InputMethodSubtype has had the same issue, and what we did was
introducing a concept "subtypeId", which allows IME developers to
specify the return value of #hashCode().

For instance, suppose that a subtype X has already been used in
production with the following attributes:
- locale: "tl_PH"
- extraValues: "key1=value1,key2=value2"

With "subtypeId", you can change the attributes of subtype X without
losing the enabled state of subtype X on devices as follows.
- locale: "fil_PH"
- extraValues: "key1=value1,key2=value2,key3=value3"
- subtypeId: Arrays.hashCode(new Object[] {
"tl_PH", "key1=value1,key2=value2"})

This CL also deprecates existing public constructor of
SpellCheckerSubtype, which was probably published as a public API by
mistake. Note that the constructor of SpellCheckerInfo class is @hide.
Also there is no public API that receives SpellCheckerSubtype object
instantiated by developers with custom data. Making developers to be
able to instantiate SpellCheckerSubtype does not make sense right now.

Bug: 11736916
Bug: 22858221
Change-Id: I98f05c1e9421c47a93769bc4a6fe11b678bc2509
/frameworks/base/core/java/android/view/textservice/SpellCheckerSubtype.java
eae60ba5a4a39d59940e9749a4ad26281d016d03 04-Dec-2015 Yohei Yukawa <yukawa@google.com> Rewrite a fake language code "tl" in SpellChecker.

With following CLs, we already have a special rewrite rule of "tl" to
"fil" for IMEs that are targeting older versions of Android earlier than
Lollipop that did not support three letter language codes and used
"tl" (Tagalog) as the language string for "fil" (Filipino).
- 92280cd309b0f5967dd253280962d8581844db89 [1]
- ed65bc0c62ca99a118057db7ad54c4ccc14d52d0 [2]

[1]: I94f203bddceb9c87710cb187cc3cc0ee6d9092a5
[2]: Ica9cd2baac002c406f92331aadd7725d7424046a

With this CL, we have the same rewrite rule for spell checker services.

Bug: 20696126
Change-Id: I0af0f520a15337e33973391c9965364e3ae1ee4c
/frameworks/base/core/java/android/view/textservice/SpellCheckerSubtype.java
658c29e86ef7c2d4c3a3fa8ebad5726d692e7c68 04-Dec-2015 Yohei Yukawa <yukawa@google.com> retry: Add @hide SpellCheckerSubtype#getLocaleObject().

This is the 2nd try of I39dc0c310158ad23ba6c987efce07deaf30ce693.

This is a mechanical refactoring with no behavior change.

With this CL, InputMethodSubtype and SpellCheckerSubtype have the same
getLocaleObject() hidden API, which makes it easy to share the logic in
subsequent CLs.

No behavior change is intended.

Bug: 11736916
Bug: 20696126
Bug: 22858221
Change-Id: I51be014c752b736a808e2b0d56e664941a218a2f
/frameworks/base/core/java/android/view/textservice/SpellCheckerSubtype.java
80a918c3bd2de754027b7e7dffdd38ed138b69ce 04-Dec-2015 Yohei Yukawa <yukawa@google.com> Revert "Add @hide SpellCheckerSubtype#getLocaleObject()."

This reverts commit e3c761c87efdee7c28461559015fa76602d4605a.

Previous CL unintentionaly contained behavior change.

Change-Id: I1e350f224df815e991d9f42ac4145ecfc5c1c8b0
/frameworks/base/core/java/android/view/textservice/SpellCheckerSubtype.java
e3c761c87efdee7c28461559015fa76602d4605a 04-Dec-2015 Yohei Yukawa <yukawa@google.com> Add @hide SpellCheckerSubtype#getLocaleObject().

This is a mechanical refactoring with no behavior change.

With this CL, InputMethodSubtype and SpellCheckerSubtype have the same
getLocaleObject() hidden API, which makes it easy to share the logic in
subsequent CLs.

Bug: 11736916
Bug: 20696126
Bug: 22858221
Change-Id: I39dc0c310158ad23ba6c987efce07deaf30ce693
/frameworks/base/core/java/android/view/textservice/SpellCheckerSubtype.java
f927e17ae543b6edeae8200cc86c59c3ee740670 24-May-2012 satok <satok@google.com> Use correct spell check locale

Bug: 6542210
Change-Id: I414aa2321f30e396996d90fb8e90c1dbb3bb7b9e
/frameworks/base/core/java/android/view/textservice/SpellCheckerSubtype.java
11299b1b8c49e53ed25dce916aa24282b2e15662 11-Jan-2012 satok <satok@google.com> Make public SpellChecker utilities

Bug: 5639238
Change-Id: Id7dd2263a6305cc6ba0cf8f4d8ad8fb0d39a48ff
/frameworks/base/core/java/android/view/textservice/SpellCheckerSubtype.java
0dc1f648a09b46c45190ba1ce7daecf7fada4347 18-Nov-2011 satok <satok@google.com> add sentence level spell checker hidden apis

Change-Id: If65c89044bed064fd01a554e33176f64f7c21c0f
/frameworks/base/core/java/android/view/textservice/SpellCheckerSubtype.java
c714531952fe1c22cae77631aa25dc7441b2b878 26-Aug-2011 satok <satok@google.com> Add getDisplayName to SpellCheckerSubtype

Change-Id: Ic4d1f494a1fb67eda73ffc8e3be1caf690a602ce
/frameworks/base/core/java/android/view/textservice/SpellCheckerSubtype.java
03b2ea1102d9e3e9f189173878706ab04533eea3 03-Aug-2011 satok <satok@google.com> Support xml configuration file for the spell checker and add the spell checker subtype

Change-Id: I74715855525fc0a1282238d593ad37aefd42bfc3
/frameworks/base/core/java/android/view/textservice/SpellCheckerSubtype.java