aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-03-18 04:10:36 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-03-18 04:10:36 -0700
commitdf6e4923519306738c85d3ca709803bcbc96297d (patch)
treefd0104a06d7ab33160056ef02a3162ce94027770 /java/src
parentbbaf50f27576c305520cebc7c94ef4f76be2318a (diff)
parentf8325ec4bb83f91d53949562556652bff315f088 (diff)
downloadlatinime-df6e4923519306738c85d3ca709803bcbc96297d.tar.gz
latinime-df6e4923519306738c85d3ca709803bcbc96297d.tar.xz
latinime-df6e4923519306738c85d3ca709803bcbc96297d.zip
am f8325ec4: am 5cb0560b: Merge "Access the dictionary pack only if have INTERNET permission" into jb-mr2-dev
* commit 'f8325ec4bb83f91d53949562556652bff315f088': Access the dictionary pack only if have INTERNET permission
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java10
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);