From 2b72aa07a9ac952e5d28cf657632e8d31d247baf Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Mon, 24 Feb 2014 14:47:54 +0900 Subject: [PATCH] Disconnect app data search client after fetching all data. Bug: 13138201 Change-Id: Ibaa3c2c22a4fe44ea23e92ce8576141bbad09b12 --- .../inputmethod/latin/DictionaryFacilitatorForSuggest.java | 6 ++++++ .../DecayingExpandableBinaryDictionaryBase.java | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/java/src/com/android/inputmethod/latin/DictionaryFacilitatorForSuggest.java b/java/src/com/android/inputmethod/latin/DictionaryFacilitatorForSuggest.java index 43d4ba421..e767e4be9 100644 --- a/java/src/com/android/inputmethod/latin/DictionaryFacilitatorForSuggest.java +++ b/java/src/com/android/inputmethod/latin/DictionaryFacilitatorForSuggest.java @@ -232,6 +232,12 @@ public class DictionaryFacilitatorForSuggest { return null != mPersonalizationDictionary; } + public void flushPersonalizationDictionary() { + if (hasPersonalizationDictionary()) { + mPersonalizationDictionary.flush(); + } + } + public void waitForLoadingMainDictionary(final long timeout, final TimeUnit unit) throws InterruptedException { mLatchForWaitingLoadingMainDictionary.await(timeout, unit); diff --git a/java/src/com/android/inputmethod/latin/personalization/DecayingExpandableBinaryDictionaryBase.java b/java/src/com/android/inputmethod/latin/personalization/DecayingExpandableBinaryDictionaryBase.java index 8f7378c58..d3734d693 100644 --- a/java/src/com/android/inputmethod/latin/personalization/DecayingExpandableBinaryDictionaryBase.java +++ b/java/src/com/android/inputmethod/latin/personalization/DecayingExpandableBinaryDictionaryBase.java @@ -68,6 +68,11 @@ public abstract class DecayingExpandableBinaryDictionaryBase extends ExpandableB dumpAllWordsForDebug(); } // Flush pending writes. + flush(); + // TODO: Quit depending on finalize() and really close the dictionary file. + } + + public void flush() { asyncFlushBinaryDictionary(); }