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

Commit 710d06ce authored by Ken Wakasa's avatar Ken Wakasa
Browse files

Suppress dictionary pack support when IS_EXPERIMENTAL is true

Change-Id: If8813cb989c1fa8744a3bf36e8514ced3c8f46a3
parent c43ff6f6
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.inputmethod.latin;

import com.android.inputmethod.latin.define.ProductionFlag;
import com.android.inputmethod.latin.makedict.BinaryDictInputOutput;
import com.android.inputmethod.latin.makedict.FormatSpec;

@@ -422,8 +423,11 @@ final class BinaryDictionaryGetter {
        // cacheWordListsFromContentProvider returns the list of files it copied to local
        // storage, but we don't really care about what was copied NOW: what we want is the
        // list of everything we ever cached, so we ignore the return value.
        // TODO: The experimental version is not supported by the Dictionary Pack Service yet
        if (!ProductionFlag.IS_EXPERIMENTAL) {
            BinaryDictionaryFileDumper.cacheWordListsFromContentProvider(locale, context,
                    hasDefaultWordList);
        }
        final File[] cachedWordLists = getCachedWordLists(locale.toString(), context);
        final String mainDictId = getMainDictId(locale);
        final DictPackSettings dictPackSettings = new DictPackSettings(context);
+19 −11
Original line number Diff line number Diff line
@@ -168,8 +168,10 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
    private int mDisplayOrientation;

    // Object for reacting to adding/removing a dictionary pack.
    // TODO: The experimental version is not supported by the Dictionary Pack Service yet.
    private BroadcastReceiver mDictionaryPackInstallReceiver =
            new DictionaryPackInstallBroadcastReceiver(this);
            ProductionFlag.IS_EXPERIMENTAL
                    ? null : new DictionaryPackInstallBroadcastReceiver(this);

    // Keeps track of most recently inserted text (multi-character key) for reverting
    private String mEnteredText;
@@ -410,6 +412,8 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
        filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
        registerReceiver(mReceiver, filter);

        // TODO: The experimental version is not supported by the Dictionary Pack Service yet.
        if (!ProductionFlag.IS_EXPERIMENTAL) {
            final IntentFilter packageFilter = new IntentFilter();
            packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
            packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
@@ -421,6 +425,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
                    DictionaryPackInstallBroadcastReceiver.NEW_DICTIONARY_INTENT_ACTION);
            registerReceiver(mDictionaryPackInstallReceiver, newDictFilter);
        }
    }

    // Has to be package-visible for unit tests
    @UsedForTesting
@@ -539,7 +544,10 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
            mSuggest = null;
        }
        unregisterReceiver(mReceiver);
        // TODO: The experimental version is not supported by the Dictionary Pack Service yet.
        if (!ProductionFlag.IS_EXPERIMENTAL) {
            unregisterReceiver(mDictionaryPackInstallReceiver);
        }
        LatinImeLogger.commit();
        LatinImeLogger.onDestroy();
        super.onDestroy();
+2 −1
Original line number Diff line number Diff line
@@ -203,7 +203,8 @@ public final class Settings extends InputMethodSettingsFragment
        final Intent intent = dictionaryLink.getIntent();

        final int number = context.getPackageManager().queryIntentActivities(intent, 0).size();
        if (0 >= number) {
        // TODO: The experimental version is not supported by the Dictionary Pack Service yet
        if (ProductionFlag.IS_EXPERIMENTAL || 0 >= number) {
            textCorrectionGroup.removePreference(dictionaryLink);
        }