Set additional attributes in dictionary facilitator.
Bug: 13197276 Change-Id: I206cf4e599ca9cdf40d669358a1067a2954d11e3main
parent
18f91cf617
commit
f8552f61a4
|
@ -36,6 +36,7 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
@ -142,7 +143,8 @@ public class DictionaryFacilitatorForSuggest {
|
||||||
|
|
||||||
@UsedForTesting
|
@UsedForTesting
|
||||||
public DictionaryFacilitatorForSuggest(final Context context, final Locale locale,
|
public DictionaryFacilitatorForSuggest(final Context context, final Locale locale,
|
||||||
final ArrayList<String> dictionaryTypes, final HashMap<String, File> dictionaryFiles) {
|
final ArrayList<String> dictionaryTypes, final HashMap<String, File> dictionaryFiles,
|
||||||
|
final Map<String, Map<String, String>> additionalDictAttributes) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mLocale = locale;
|
mLocale = locale;
|
||||||
mLatchForWaitingLoadingMainDictionary = new CountDownLatch(0);
|
mLatchForWaitingLoadingMainDictionary = new CountDownLatch(0);
|
||||||
|
@ -159,6 +161,10 @@ public class DictionaryFacilitatorForSuggest {
|
||||||
userHistoryDictionary.reloadDictionaryIfRequired();
|
userHistoryDictionary.reloadDictionaryIfRequired();
|
||||||
userHistoryDictionary.waitAllTasksForTests();
|
userHistoryDictionary.waitAllTasksForTests();
|
||||||
setUserHistoryDictionary(userHistoryDictionary);
|
setUserHistoryDictionary(userHistoryDictionary);
|
||||||
|
if (additionalDictAttributes.containsKey(dictType)) {
|
||||||
|
userHistoryDictionary.clearAndFlushDictionaryWithAdditionalAttributes(
|
||||||
|
additionalDictAttributes.get(dictType));
|
||||||
|
}
|
||||||
} else if (dictType.equals(Dictionary.TYPE_PERSONALIZATION)) {
|
} else if (dictType.equals(Dictionary.TYPE_PERSONALIZATION)) {
|
||||||
final PersonalizationDictionary personalizationDictionary =
|
final PersonalizationDictionary personalizationDictionary =
|
||||||
PersonalizationHelper.getPersonalizationDictionary(context, locale);
|
PersonalizationHelper.getPersonalizationDictionary(context, locale);
|
||||||
|
@ -167,6 +173,10 @@ public class DictionaryFacilitatorForSuggest {
|
||||||
personalizationDictionary.reloadDictionaryIfRequired();
|
personalizationDictionary.reloadDictionaryIfRequired();
|
||||||
personalizationDictionary.waitAllTasksForTests();
|
personalizationDictionary.waitAllTasksForTests();
|
||||||
setPersonalizationDictionary(personalizationDictionary);
|
setPersonalizationDictionary(personalizationDictionary);
|
||||||
|
if (additionalDictAttributes.containsKey(dictType)) {
|
||||||
|
personalizationDictionary.clearAndFlushDictionaryWithAdditionalAttributes(
|
||||||
|
additionalDictAttributes.get(dictType));
|
||||||
|
}
|
||||||
} else if (dictType.equals(Dictionary.TYPE_USER)) {
|
} else if (dictType.equals(Dictionary.TYPE_USER)) {
|
||||||
final File file = dictionaryFiles.get(dictType);
|
final File file = dictionaryFiles.get(dictType);
|
||||||
final UserBinaryDictionary userDictionary = new UserBinaryDictionary(
|
final UserBinaryDictionary userDictionary = new UserBinaryDictionary(
|
||||||
|
|
Loading…
Reference in New Issue