Bug 5575396: close spell session on language change
Change-Id: I661812c316ec9d98f66379357cbd1216bae65fa0
diff --git a/core/java/android/widget/SpellChecker.java b/core/java/android/widget/SpellChecker.java
index 5fbbe4d..e392fd2 100644
--- a/core/java/android/widget/SpellChecker.java
+++ b/core/java/android/widget/SpellChecker.java
@@ -82,6 +82,8 @@
}
private void setLocale(Locale locale) {
+ closeSession();
+
final TextServicesManager textServicesManager = (TextServicesManager)
mTextView.getContext().getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE);
mSpellCheckerSession = textServicesManager.newSpellCheckerSession(
@@ -99,12 +101,6 @@
// Change SpellParsers' wordIterator locale
mWordIterator = new WordIterator(locale);
- // Stop all SpellParsers
- final int length = mSpellParsers.length;
- for (int i = 0; i < length; i++) {
- mSpellParsers[i].finish();
- }
-
// Remove existing misspelled SuggestionSpans
mTextView.removeMisspelledSpans((Editable) mTextView.getText());