Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6166d37 authored by Jean Chalard's avatar Jean Chalard
Browse files

Fix a bug where Latin IME crashes on spell checker request

Bug: 6611183
Change-Id: I8a879feb598e1ac55d73f9cb27e54aa533d3a010
parent 7f7739fe
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -20,12 +20,13 @@ import android.content.Context;

import com.android.inputmethod.keyboard.ProximityInfo;

import java.util.Locale;

public class SynchronouslyLoadedContactsBinaryDictionary extends ContactsBinaryDictionary {
    private boolean mClosed;

    public SynchronouslyLoadedContactsBinaryDictionary(final Context context) {
        // TODO: add locale information.
        super(context, Suggest.DIC_CONTACTS, null);
    public SynchronouslyLoadedContactsBinaryDictionary(final Context context, final Locale locale) {
        super(context, Suggest.DIC_CONTACTS, locale);
    }

    @Override
+8 −2
Original line number Diff line number Diff line
@@ -155,7 +155,9 @@ public class AndroidSpellCheckerService extends SpellCheckerService
    private void startUsingContactsDictionaryLocked() {
        if (null == mContactsDictionary) {
            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 {
                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
                    // longer needed
                    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 {
                        mContactsDictionary = new SynchronouslyLoadedContactsDictionary(this);
                    }