Merge "Fix another deadlock between IMMS and TSMS" into nyc-mr1-dev

This commit is contained in:
Yohei Yukawa
2016-09-20 17:53:26 +00:00
committed by Android (Google) Code Review

View File

@@ -459,13 +459,18 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
if (!calledFromValidUser()) { if (!calledFromValidUser()) {
return null; return null;
} }
final int subtypeHashCode;
final SpellCheckerInfo sci;
final Locale systemLocale;
synchronized (mSpellCheckerMap) { synchronized (mSpellCheckerMap) {
final int subtypeHashCode = subtypeHashCode =
mSettings.getSelectedSpellCheckerSubtype(SpellCheckerSubtype.SUBTYPE_ID_NONE); mSettings.getSelectedSpellCheckerSubtype(SpellCheckerSubtype.SUBTYPE_ID_NONE);
if (DBG) { if (DBG) {
Slog.w(TAG, "getCurrentSpellCheckerSubtype: " + subtypeHashCode); Slog.w(TAG, "getCurrentSpellCheckerSubtype: " + subtypeHashCode);
} }
final SpellCheckerInfo sci = getCurrentSpellChecker(null); sci = getCurrentSpellChecker(null);
systemLocale = mContext.getResources().getConfiguration().locale;
}
if (sci == null || sci.getSubtypeCount() == 0) { if (sci == null || sci.getSubtypeCount() == 0) {
if (DBG) { if (DBG) {
Slog.w(TAG, "Subtype not found."); Slog.w(TAG, "Subtype not found.");
@@ -493,7 +498,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
} }
if (candidateLocale == null) { if (candidateLocale == null) {
// 2. Use System locale if available in the spell checker // 2. Use System locale if available in the spell checker
candidateLocale = mContext.getResources().getConfiguration().locale.toString(); candidateLocale = systemLocale.toString();
} }
} }
SpellCheckerSubtype candidate = null; SpellCheckerSubtype candidate = null;
@@ -524,7 +529,6 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
// spell check languages // spell check languages
return candidate; return candidate;
} }
}
@Override @Override
public void getSpellCheckerService(String sciId, String locale, public void getSpellCheckerService(String sciId, String locale,