am e55d44c5: Merge "Add a method to create dict with additional attributes."

* commit 'e55d44c53526e74f32fbd4b1dd305aae8d7ac8e4':
  Add a method to create dict with additional attributes.
main
Keisuke Kuroyanagi 2014-02-26 02:10:21 -08:00 committed by Android Git Automerger
commit 315ba01ccf
1 changed files with 12 additions and 1 deletions

View File

@ -50,6 +50,7 @@ public abstract class DecayingExpandableBinaryDictionaryBase extends ExpandableB
public final Locale mLocale;
private final String mDictName;
private Map<String, String> mAdditionalAttributeMap = null;
protected DecayingExpandableBinaryDictionaryBase(final Context context,
final String dictName, final Locale locale, final String dictionaryType,
@ -78,7 +79,10 @@ public abstract class DecayingExpandableBinaryDictionaryBase extends ExpandableB
@Override
protected Map<String, String> getHeaderAttributeMap() {
HashMap<String, String> attributeMap = new HashMap<String, String>();
final Map<String, String> attributeMap = new HashMap<String, String>();
if (mAdditionalAttributeMap != null) {
attributeMap.putAll(mAdditionalAttributeMap);
}
attributeMap.put(DictionaryHeader.USES_FORGETTING_CURVE_KEY,
DictionaryHeader.ATTRIBUTE_VALUE_TRUE);
attributeMap.put(DictionaryHeader.HAS_HISTORICAL_INFO_KEY,
@ -152,6 +156,13 @@ public abstract class DecayingExpandableBinaryDictionaryBase extends ExpandableB
asyncFlushBinaryDictionary();
}
@UsedForTesting
public void clearAndFlushDictionaryWithAdditionalAttributes(
final Map<String, String> attributeMap) {
mAdditionalAttributeMap = attributeMap;
clearAndFlushDictionary();
}
/* package */ void decayIfNeeded() {
runGCIfRequired(false /* mindsBlockByGC */);
}