aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java')
-rw-r--r--java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java37
1 files changed, 12 insertions, 25 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
index 98eadcacb..fa301b5a6 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
@@ -16,17 +16,17 @@
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;
-
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;
+import com.android.inputmethod.latin.makedict.BinaryDictInputOutput;
+import com.android.inputmethod.latin.makedict.FormatSpec;
+import com.android.inputmethod.latin.utils.CollectionUtils;
+import com.android.inputmethod.latin.utils.DictionaryInfoUtils;
+import com.android.inputmethod.latin.utils.LocaleUtils;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -39,7 +39,7 @@ import java.util.Locale;
/**
* Helper class to get the address of a mmap'able dictionary file.
*/
-final class BinaryDictionaryGetter {
+final public class BinaryDictionaryGetter {
/**
* Used for Log actions from this class
@@ -223,14 +223,10 @@ final class BinaryDictionaryGetter {
}
}
- // ## HACK ## we prevent usage of a dictionary before version 18 for English only. The reason
- // for this is, since those do not include whitelist entries, the new code with an old version
- // of the dictionary would lose whitelist functionality.
+ // ## HACK ## we prevent usage of a dictionary before version 18. The reason for this is, since
+ // those do not include whitelist entries, the new code with an old version of the dictionary
+ // would lose whitelist functionality.
private static boolean hackCanUseDictionaryFile(final Locale locale, final File f) {
- // Only for English - other languages didn't have a whitelist, hence this
- // ad-hoc ## HACK ##
- if (!Locale.ENGLISH.getLanguage().equals(locale.getLanguage())) return true;
-
FileInputStream inStream = null;
try {
// Read the version of the file
@@ -290,17 +286,8 @@ final class BinaryDictionaryGetter {
final Context context) {
final boolean hasDefaultWordList = DictionaryFactory.isDictionaryAvailable(context, locale);
- // TODO: The development-only-diagnostic version is not supported by the Dictionary Pack
- // Service yet
- if (!ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
- // 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);
- }
- }
+ BinaryDictionaryFileDumper.cacheWordListsFromContentProvider(locale, context,
+ hasDefaultWordList);
final File[] cachedWordLists = getCachedWordLists(locale.toString(), context);
final String mainDictId = DictionaryInfoUtils.getMainDictId(locale);
final DictPackSettings dictPackSettings = new DictPackSettings(context);