Skip to content

Commit 17150cf

Browse files
committed
Fix locale in TextServicesManagerService
Bug: 6542210 Change-Id: I1670fac014beb834ec7c065ebf040d0ff3cf4161
1 parent 38616cc commit 17150cf

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

core/java/android/view/textservice/TextServicesManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public void setCurrentSpellChecker(SpellCheckerInfo sci) {
217217
public SpellCheckerSubtype getCurrentSpellCheckerSubtype(
218218
boolean allowImplicitlySelectedSubtype) {
219219
try {
220-
// Passing null as a locale for ICS
220+
// Passing null as a locale until we support multiple enabled spell checker subtypes.
221221
return sService.getCurrentSpellCheckerSubtype(null, allowImplicitlySelectedSubtype);
222222
} catch (RemoteException e) {
223223
Log.e(TAG, "Error in getCurrentSpellCheckerSubtype: " + e);

services/java/com/android/server/TextServicesManagerService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public SpellCheckerInfo getCurrentSpellChecker(String locale) {
198198
}
199199

200200
// TODO: Respect allowImplicitlySelectedSubtype
201-
// TODO: Save SpellCheckerSubtype by supported languages.
201+
// TODO: Save SpellCheckerSubtype by supported languages by looking at "locale".
202202
@Override
203203
public SpellCheckerSubtype getCurrentSpellCheckerSubtype(
204204
String locale, boolean allowImplicitlySelectedSubtype) {
@@ -250,10 +250,10 @@ public SpellCheckerSubtype getCurrentSpellCheckerSubtype(
250250
for (int i = 0; i < sci.getSubtypeCount(); ++i) {
251251
final SpellCheckerSubtype scs = sci.getSubtypeAt(i);
252252
if (hashCode == 0) {
253-
if (candidateLocale.equals(locale)) {
253+
final String scsLocale = scs.getLocale();
254+
if (candidateLocale.equals(scsLocale)) {
254255
return scs;
255256
} else if (candidate == null) {
256-
final String scsLocale = scs.getLocale();
257257
if (candidateLocale.length() >= 2 && scsLocale.length() >= 2
258258
&& candidateLocale.startsWith(scsLocale)) {
259259
// Fall back to the applicable language

0 commit comments

Comments
 (0)