Suppress dictionary pack support when IS_EXPERIMENTAL is true
Change-Id: If8813cb989c1fa8744a3bf36e8514ced3c8f46a3main
parent
c43ff6f66c
commit
710d06cea9
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package com.android.inputmethod.latin;
|
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.BinaryDictInputOutput;
|
||||||
import com.android.inputmethod.latin.makedict.FormatSpec;
|
import com.android.inputmethod.latin.makedict.FormatSpec;
|
||||||
|
|
||||||
|
@ -422,8 +423,11 @@ final class BinaryDictionaryGetter {
|
||||||
// cacheWordListsFromContentProvider returns the list of files it copied to local
|
// 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
|
// 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.
|
// 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,
|
BinaryDictionaryFileDumper.cacheWordListsFromContentProvider(locale, context,
|
||||||
hasDefaultWordList);
|
hasDefaultWordList);
|
||||||
|
}
|
||||||
final File[] cachedWordLists = getCachedWordLists(locale.toString(), context);
|
final File[] cachedWordLists = getCachedWordLists(locale.toString(), context);
|
||||||
final String mainDictId = getMainDictId(locale);
|
final String mainDictId = getMainDictId(locale);
|
||||||
final DictPackSettings dictPackSettings = new DictPackSettings(context);
|
final DictPackSettings dictPackSettings = new DictPackSettings(context);
|
||||||
|
|
|
@ -168,8 +168,10 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
||||||
private int mDisplayOrientation;
|
private int mDisplayOrientation;
|
||||||
|
|
||||||
// Object for reacting to adding/removing a dictionary pack.
|
// 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 =
|
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
|
// Keeps track of most recently inserted text (multi-character key) for reverting
|
||||||
private String mEnteredText;
|
private String mEnteredText;
|
||||||
|
@ -410,6 +412,8 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
||||||
filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
|
filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
|
||||||
registerReceiver(mReceiver, filter);
|
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();
|
final IntentFilter packageFilter = new IntentFilter();
|
||||||
packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
|
packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
|
||||||
packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
||||||
|
@ -421,6 +425,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
||||||
DictionaryPackInstallBroadcastReceiver.NEW_DICTIONARY_INTENT_ACTION);
|
DictionaryPackInstallBroadcastReceiver.NEW_DICTIONARY_INTENT_ACTION);
|
||||||
registerReceiver(mDictionaryPackInstallReceiver, newDictFilter);
|
registerReceiver(mDictionaryPackInstallReceiver, newDictFilter);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Has to be package-visible for unit tests
|
// Has to be package-visible for unit tests
|
||||||
@UsedForTesting
|
@UsedForTesting
|
||||||
|
@ -539,7 +544,10 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
||||||
mSuggest = null;
|
mSuggest = null;
|
||||||
}
|
}
|
||||||
unregisterReceiver(mReceiver);
|
unregisterReceiver(mReceiver);
|
||||||
|
// TODO: The experimental version is not supported by the Dictionary Pack Service yet.
|
||||||
|
if (!ProductionFlag.IS_EXPERIMENTAL) {
|
||||||
unregisterReceiver(mDictionaryPackInstallReceiver);
|
unregisterReceiver(mDictionaryPackInstallReceiver);
|
||||||
|
}
|
||||||
LatinImeLogger.commit();
|
LatinImeLogger.commit();
|
||||||
LatinImeLogger.onDestroy();
|
LatinImeLogger.onDestroy();
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|
|
@ -203,7 +203,8 @@ public final class Settings extends InputMethodSettingsFragment
|
||||||
final Intent intent = dictionaryLink.getIntent();
|
final Intent intent = dictionaryLink.getIntent();
|
||||||
|
|
||||||
final int number = context.getPackageManager().queryIntentActivities(intent, 0).size();
|
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);
|
textCorrectionGroup.removePreference(dictionaryLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue