Remove clearAndFlushDictionary() and use clear().
clearAndFlushDictionary() was needed when dictionaries are constructed in java side. All expandable dictionaries now use native code; thus, this method is same to clear() and no longer needed. Bug: 13755213 Change-Id: Ifd836e64f8ff807930f7cd2319b103b65e8fce70main
parent
7de3d0eed7
commit
2dcb5c1b4d
|
@ -542,7 +542,7 @@ public class DictionaryFacilitatorForSuggest {
|
||||||
if (userHistoryDict == null) {
|
if (userHistoryDict == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
userHistoryDict.clearAndFlushDictionary();
|
userHistoryDict.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called only when the IME receives a notification to remove the
|
// This method gets called only when the IME receives a notification to remove the
|
||||||
|
@ -553,7 +553,7 @@ public class DictionaryFacilitatorForSuggest {
|
||||||
if (personalizationDict == null) {
|
if (personalizationDict == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
personalizationDict.clearAndFlushDictionary();
|
personalizationDict.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMultipleDictionaryEntriesToPersonalizationDictionary(
|
public void addMultipleDictionaryEntriesToPersonalizationDictionary(
|
||||||
|
|
|
@ -244,7 +244,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
||||||
true /* useFullEditDistance */, mLocale, mDictType, true /* isUpdatable */);
|
true /* useFullEditDistance */, mLocale, mDictType, true /* isUpdatable */);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void clear() {
|
public void clear() {
|
||||||
ExecutorUtils.getExecutor(mDictName).execute(new Runnable() {
|
ExecutorUtils.getExecutor(mDictName).execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -135,19 +135,11 @@ public abstract class DecayingExpandableBinaryDictionaryBase extends ExpandableB
|
||||||
// No initial contents.
|
// No initial contents.
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
public void clearAndFlushDictionary() {
|
|
||||||
// Clear the node structure on memory
|
|
||||||
clear();
|
|
||||||
// Then flush the cleared state of the dictionary on disk.
|
|
||||||
asyncFlushBinaryDictionary();
|
|
||||||
}
|
|
||||||
|
|
||||||
@UsedForTesting
|
@UsedForTesting
|
||||||
public void clearAndFlushDictionaryWithAdditionalAttributes(
|
public void clearAndFlushDictionaryWithAdditionalAttributes(
|
||||||
final Map<String, String> attributeMap) {
|
final Map<String, String> attributeMap) {
|
||||||
mAdditionalAttributeMap = attributeMap;
|
mAdditionalAttributeMap = attributeMap;
|
||||||
clearAndFlushDictionary();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ void runGCIfRequired() {
|
/* package */ void runGCIfRequired() {
|
||||||
|
|
|
@ -135,7 +135,7 @@ public class PersonalizationHelper {
|
||||||
if (entry.getValue() != null) {
|
if (entry.getValue() != null) {
|
||||||
final DecayingExpandableBinaryDictionaryBase dict = entry.getValue().get();
|
final DecayingExpandableBinaryDictionaryBase dict = entry.getValue().get();
|
||||||
if (dict != null) {
|
if (dict != null) {
|
||||||
dict.clearAndFlushDictionary();
|
dict.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
|
||||||
final UserHistoryDictionary dict = PersonalizationHelper.getUserHistoryDictionary(
|
final UserHistoryDictionary dict = PersonalizationHelper.getUserHistoryDictionary(
|
||||||
mContext, locale);
|
mContext, locale);
|
||||||
dict.waitAllTasksForTests();
|
dict.waitAllTasksForTests();
|
||||||
dict.clearAndFlushDictionary();
|
dict.clear();
|
||||||
dict.close();
|
dict.close();
|
||||||
dict.waitAllTasksForTests();
|
dict.waitAllTasksForTests();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue