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

Commit d6496c09 authored by Jean Chalard's avatar Jean Chalard Committed by Android (Google) Code Review
Browse files

Merge "Fix a bug with the user dictionary locale."

parents 2631e3b1 d113fd0b
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -34,7 +34,10 @@ import java.util.Arrays;
 */
public class UserBinaryDictionary extends ExpandableBinaryDictionary {

    // TODO: use Words.SHORTCUT when it's public in the SDK
    // The user dictionary provider uses an empty string to mean "all languages".
    private static final String USER_DICTIONARY_ALL_LANGUAGES = "";

    // TODO: use Words.SHORTCUT when we target JellyBean or above
    final static String SHORTCUT = "shortcut";
    private static final String[] PROJECTION_QUERY;
    static {
@@ -71,7 +74,12 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary {
            final boolean alsoUseMoreRestrictiveLocales) {
        super(context, getFilenameWithLocale(NAME, locale), Dictionary.TYPE_USER);
        if (null == locale) throw new NullPointerException(); // Catch the error earlier
        if (SubtypeLocale.NO_LANGUAGE.equals(locale)) {
            // If we don't have a locale, insert into the "all locales" user dictionary.
            mLocale = USER_DICTIONARY_ALL_LANGUAGES;
        } else {
            mLocale = locale;
        }
        mAlsoUseMoreRestrictiveLocales = alsoUseMoreRestrictiveLocales;
        // Perform a managed query. The Activity will handle closing and re-querying the cursor
        // when needed.