diff options
author | 2013-03-18 11:04:53 +0000 | |
---|---|---|
committer | 2013-03-18 11:04:53 +0000 | |
commit | 5cb0560b000f37b3fb3937f01b6d3e928afef57a (patch) | |
tree | e8065e389e96c7ab4c2b884ee63689666a37e960 /java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java | |
parent | e0e67373735918c78eaeaf24f127e1d28816aa29 (diff) | |
parent | ce487bcf33be39eed4ed56e6b98603cc87fda2eb (diff) | |
download | latinime-5cb0560b000f37b3fb3937f01b6d3e928afef57a.tar.gz latinime-5cb0560b000f37b3fb3937f01b6d3e928afef57a.tar.xz latinime-5cb0560b000f37b3fb3937f01b6d3e928afef57a.zip |
Merge "Access the dictionary pack only if have INTERNET permission" into jb-mr2-dev
Diffstat (limited to 'java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java index e913f2852..94598c810 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java @@ -22,6 +22,7 @@ import com.android.inputmethod.latin.makedict.FormatSpec; import android.content.Context; import android.content.SharedPreferences; +import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.AssetFileDescriptor; import android.util.Log; @@ -290,8 +291,13 @@ final class BinaryDictionaryGetter { // 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); + // 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, + hasDefaultWordList); + } } final File[] cachedWordLists = getCachedWordLists(locale.toString(), context); final String mainDictId = DictionaryInfoUtils.getMainDictId(locale); |