Commit 170e24d4 authored by Bryan Ferris's avatar Bryan Ferris

Revert "Select only preinstalled Spell Checker Services"

This reverts commit fa265ed9.

Reason for revert: The backport for b/118694079 was applied improperly.

The fix involved filtering the class members list of spell checkers into a new list before searching it. The backport filtered the list but failed to update references to the class member into references to the local variable, creating no change in observable behavior. A new version of this commit will be simultaneously uploaded, which both fixes the bad behavior and allows us to have exactly 1 CL per branch that fixes the issue.

Bug: 118694079

Change-Id: Ic38a2ca2ddede7f0929779b0f2292b7823c11e87
Merged-In: Idab3ecc246fe9344a09e6907a0ba39f8ea6506f9
parent 73f398d3
......@@ -183,7 +183,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
buildSpellCheckerMapLocked(mContext, mSpellCheckerList, mSpellCheckerMap, mSettings);
SpellCheckerInfo sci = getCurrentSpellChecker(null);
if (sci == null) {
sci = findAvailSystemSpellCheckerLocked(null);
sci = findAvailSpellCheckerLocked(null);
if (sci != null) {
// Set the current spell checker if there is one or more spell checkers
// available. In this case, "sci" is the first one in the available spell
......@@ -227,7 +227,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
change == PACKAGE_PERMANENT_CHANGE || change == PACKAGE_TEMPORARY_CHANGE
// Package modified
|| isPackageModified(packageName)) {
sci = findAvailSystemSpellCheckerLocked(packageName);
sci = findAvailSpellCheckerLocked(packageName);
if (sci != null) {
setCurrentSpellCheckerLocked(sci.getId());
}
......@@ -371,16 +371,8 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
mSpellCheckerBindGroups.clear();
}
private SpellCheckerInfo findAvailSystemSpellCheckerLocked(String prefPackage) {
// Filter the spell checker list to remove spell checker services that are not pre-installed
ArrayList<SpellCheckerInfo> spellCheckerList = new ArrayList<>();
for (SpellCheckerInfo sci : mSpellCheckerList) {
if ((sci.getServiceInfo().applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
spellCheckerList.add(sci);
}
}
final int spellCheckersCount = spellCheckerList.size();
private SpellCheckerInfo findAvailSpellCheckerLocked(String prefPackage) {
final int spellCheckersCount = mSpellCheckerList.size();
if (spellCheckersCount == 0) {
Slog.w(TAG, "no available spell checker services found");
return null;
......@@ -390,7 +382,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
final SpellCheckerInfo sci = mSpellCheckerList.get(i);
if (prefPackage.equals(sci.getPackageName())) {
if (DBG) {
Slog.d(TAG, "findAvailSystemSpellCheckerLocked: " + sci.getPackageName());
Slog.d(TAG, "findAvailSpellCheckerLocked: " + sci.getPackageName());
}
return sci;
}
......@@ -404,7 +396,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
final ArrayList<Locale> suitableLocales =
InputMethodUtils.getSuitableLocalesForSpellChecker(systemLocal);
if (DBG) {
Slog.w(TAG, "findAvailSystemSpellCheckerLocked suitableLocales="
Slog.w(TAG, "findAvailSpellCheckerLocked suitableLocales="
+ Arrays.toString(suitableLocales.toArray(new Locale[suitableLocales.size()])));
}
final int localeCount = suitableLocales.size();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment