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

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

Merge "Accept whitelisted entries from any source." into jb-mr1-dev

parents 58040e7d 7b258e51
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -208,15 +208,24 @@ public class Suggest {
                    wordComposerForLookup, prevWordForBigram, proximityInfo));
        }

        final CharSequence whitelistedWord =
        final CharSequence whitelistedWordFromWhitelistDictionary =
                mWhiteListDictionary.getWhitelistedWord(consideredWord);
        if (whitelistedWord != null) {
        if (whitelistedWordFromWhitelistDictionary != null) {
            // MAX_SCORE ensures this will be considered strong enough to be auto-corrected
            suggestionsSet.add(new SuggestedWordInfo(whitelistedWord,
            suggestionsSet.add(new SuggestedWordInfo(whitelistedWordFromWhitelistDictionary,
                    SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_WHITELIST,
                    Dictionary.TYPE_WHITELIST));
        }

        final CharSequence whitelistedWord;
        if (suggestionsSet.isEmpty()) {
            whitelistedWord = null;
        } else if (SuggestedWordInfo.KIND_WHITELIST != suggestionsSet.first().mKind) {
            whitelistedWord = null;
        } else {
            whitelistedWord = suggestionsSet.first().mWord;
        }

        // TODO: Change this scheme - a boolean is not enough. A whitelisted word may be "valid"
        // but still autocorrected from - in the case the whitelist only capitalizes the word.
        // The whitelist should be case-insensitive, so it's not possible to be consistent with