Loading java/src/com/android/inputmethod/latin/personalization/DynamicPredictionDictionaryBase.java +14 −0 Original line number Diff line number Diff line Loading @@ -411,4 +411,18 @@ public abstract class DynamicPredictionDictionaryBase extends ExpandableDictiona public void unRegisterUpdateSession(PersonalizationDictionaryUpdateSession session) { mSessions.remove(session); } public void clearAndFlushDictionary() { // Clear the node structure on memory clearDictionary(); mBigramListLock.lock(); try { // Clear the bigram list on memory mBigramList.evictAll(); } finally { mBigramListLock.unlock(); } // Then flush the cleared state of the dictionary on disk. flushPendingWrites(); } } java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdateSession.java +7 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,13 @@ public abstract class PersonalizationDictionaryUpdateSession { dictionary.unRegisterUpdateSession(this); } public void clearAndFlushPredictionDictionary(Context context) { final DynamicPredictionDictionaryBase dictionary = getPredictionDictionary(); if (dictionary == null) { return; } dictionary.clearAndFlushDictionary(); } public void closeSession(Context context) { unsetPredictionDictionary(); Loading Loading
java/src/com/android/inputmethod/latin/personalization/DynamicPredictionDictionaryBase.java +14 −0 Original line number Diff line number Diff line Loading @@ -411,4 +411,18 @@ public abstract class DynamicPredictionDictionaryBase extends ExpandableDictiona public void unRegisterUpdateSession(PersonalizationDictionaryUpdateSession session) { mSessions.remove(session); } public void clearAndFlushDictionary() { // Clear the node structure on memory clearDictionary(); mBigramListLock.lock(); try { // Clear the bigram list on memory mBigramList.evictAll(); } finally { mBigramListLock.unlock(); } // Then flush the cleared state of the dictionary on disk. flushPendingWrites(); } }
java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdateSession.java +7 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,13 @@ public abstract class PersonalizationDictionaryUpdateSession { dictionary.unRegisterUpdateSession(this); } public void clearAndFlushPredictionDictionary(Context context) { final DynamicPredictionDictionaryBase dictionary = getPredictionDictionary(); if (dictionary == null) { return; } dictionary.clearAndFlushDictionary(); } public void closeSession(Context context) { unsetPredictionDictionary(); Loading