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

Commit 0126566c authored by Jean Chalard's avatar Jean Chalard Committed by Android Git Automerger
Browse files

am 0ded4114: am 73ca0f2c: am 423921ca: Merge "Fallback on empty locales."

* commit '0ded4114':
  Fallback on empty locales.
parents 470f13fc 0ded4114
Loading
Loading
Loading
Loading
+18 −2
Original line number Original line Diff line number Diff line
@@ -605,8 +605,24 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
    }
    }


    private void initSuggest() {
    private void initSuggest() {
        final Locale subtypeLocale = mSubtypeSwitcher.getCurrentSubtypeLocale();
        final Locale switcherSubtypeLocale = mSubtypeSwitcher.getCurrentSubtypeLocale();
        final String localeStr = subtypeLocale.toString();
        final String switcherLocaleStr = switcherSubtypeLocale.toString();
        final Locale subtypeLocale;
        final String localeStr;
        if (TextUtils.isEmpty(switcherLocaleStr)) {
            // This happens in very rare corner cases - for example, immediately after a switch
            // to LatinIME has been requested, about a frame later another switch happens. In this
            // case, we are about to go down but we still don't know it, however the system tells
            // us there is no current subtype so the locale is the empty string. Take the best
            // possible guess instead -- it's bound to have no consequences, and we have no way
            // of knowing anyway.
            Log.e(TAG, "System is reporting no current subtype.");
            subtypeLocale = getResources().getConfiguration().locale;
            localeStr = subtypeLocale.toString();
        } else {
            subtypeLocale = switcherSubtypeLocale;
            localeStr = switcherLocaleStr;
        }


        final Suggest newSuggest = new Suggest(this /* Context */, subtypeLocale,
        final Suggest newSuggest = new Suggest(this /* Context */, subtypeLocale,
                this /* SuggestInitializationListener */);
                this /* SuggestInitializationListener */);