am c750f9eb: am a6166d37: Fix a bug where Latin IME crashes on spell checker request

* commit 'c750f9eb5398a30b207891e6858863f493875199':
  Fix a bug where Latin IME crashes on spell checker request
This commit is contained in:
Jean Chalard 2012-06-05 09:54:58 -07:00 committed by Android Git Automerger
commit 5235e0cd91
2 changed files with 13 additions and 6 deletions

View file

@ -20,12 +20,13 @@ import android.content.Context;
import com.android.inputmethod.keyboard.ProximityInfo; import com.android.inputmethod.keyboard.ProximityInfo;
import java.util.Locale;
public class SynchronouslyLoadedContactsBinaryDictionary extends ContactsBinaryDictionary { public class SynchronouslyLoadedContactsBinaryDictionary extends ContactsBinaryDictionary {
private boolean mClosed; private boolean mClosed;
public SynchronouslyLoadedContactsBinaryDictionary(final Context context) { public SynchronouslyLoadedContactsBinaryDictionary(final Context context, final Locale locale) {
// TODO: add locale information. super(context, Suggest.DIC_CONTACTS, locale);
super(context, Suggest.DIC_CONTACTS, null);
} }
@Override @Override

View file

@ -155,7 +155,9 @@ public class AndroidSpellCheckerService extends SpellCheckerService
private void startUsingContactsDictionaryLocked() { private void startUsingContactsDictionaryLocked() {
if (null == mContactsDictionary) { if (null == mContactsDictionary) {
if (LatinIME.USE_BINARY_CONTACTS_DICTIONARY) { if (LatinIME.USE_BINARY_CONTACTS_DICTIONARY) {
mContactsDictionary = new SynchronouslyLoadedContactsBinaryDictionary(this); // TODO: use the right locale for each session
mContactsDictionary =
new SynchronouslyLoadedContactsBinaryDictionary(this, Locale.getDefault());
} else { } else {
mContactsDictionary = new SynchronouslyLoadedContactsDictionary(this); mContactsDictionary = new SynchronouslyLoadedContactsDictionary(this);
} }
@ -436,7 +438,11 @@ public class AndroidSpellCheckerService extends SpellCheckerService
// TODO: revert to the concrete type when USE_BINARY_CONTACTS_DICTIONARY is no // TODO: revert to the concrete type when USE_BINARY_CONTACTS_DICTIONARY is no
// longer needed // longer needed
if (LatinIME.USE_BINARY_CONTACTS_DICTIONARY) { if (LatinIME.USE_BINARY_CONTACTS_DICTIONARY) {
mContactsDictionary = new SynchronouslyLoadedContactsBinaryDictionary(this); // TODO: use the right locale. We can't do it right now because the
// spell checker is reusing the contacts dictionary across sessions
// without regard for their locale, so we need to fix that first.
mContactsDictionary = new SynchronouslyLoadedContactsBinaryDictionary(this,
Locale.getDefault());
} else { } else {
mContactsDictionary = new SynchronouslyLoadedContactsDictionary(this); mContactsDictionary = new SynchronouslyLoadedContactsDictionary(this);
} }