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

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

Access the dictionary pack only if have INTERNET permission

Bug: 8161354
Change-Id: I68ee3acb2955a017d25666cc2dad791798f9064a
parent 620be98f
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ import com.android.inputmethod.latin.makedict.FormatSpec;


import android.content.Context;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.AssetFileDescriptor;
import android.content.res.AssetFileDescriptor;
import android.util.Log;
import android.util.Log;
@@ -290,9 +291,14 @@ final class BinaryDictionaryGetter {
        // list of everything we ever cached, so we ignore the return value.
        // 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
        // TODO: The experimental version is not supported by the Dictionary Pack Service yet
        if (!ProductionFlag.IS_EXPERIMENTAL) {
        if (!ProductionFlag.IS_EXPERIMENTAL) {
            // We need internet access to do the following. Only do this if the package actually
            // has the permission.
            if (context.checkCallingOrSelfPermission(android.Manifest.permission.INTERNET)
                    == PackageManager.PERMISSION_GRANTED) {
                BinaryDictionaryFileDumper.cacheWordListsFromContentProvider(locale, context,
                BinaryDictionaryFileDumper.cacheWordListsFromContentProvider(locale, context,
                        hasDefaultWordList);
                        hasDefaultWordList);
            }
            }
        }
        final File[] cachedWordLists = getCachedWordLists(locale.toString(), context);
        final File[] cachedWordLists = getCachedWordLists(locale.toString(), context);
        final String mainDictId = DictionaryInfoUtils.getMainDictId(locale);
        final String mainDictId = DictionaryInfoUtils.getMainDictId(locale);
        final DictPackSettings dictPackSettings = new DictPackSettings(context);
        final DictPackSettings dictPackSettings = new DictPackSettings(context);