From 4426cbc59ed026c07da2d1a91e8057562c304d58 Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Mon, 28 Apr 2014 22:15:52 +0900 Subject: [PATCH] Fix: contacts/user dicts are too frequently regenerated. Change-Id: I6b04a58c543fda6df7a2c016b8b8a5300f137d73 --- .../inputmethod/latin/ExpandableBinaryDictionary.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java index 08f3c63a3..550db4a6c 100644 --- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java @@ -511,12 +511,12 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { */ private final void asyncReloadDictionary() { if (mIsReloading.compareAndSet(false, true)) { - mNeedsToReload = false; asyncExecuteTaskWithWriteLock(new Runnable() { @Override public void run() { try { - if (!mDictFile.exists() || haveContentsChanged()) { + // TODO: Quit checking contents in ExpandableBinaryDictionary. + if (!mDictFile.exists() || (mNeedsToReload && haveContentsChanged())) { // If the dictionary file does not exist or contents have been updated, // generate a new one. createNewDictionaryLocked(); @@ -524,6 +524,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { // Otherwise, load the existing dictionary. loadBinaryDictionaryLocked(); } + mNeedsToReload = false; if (mBinaryDictionary != null && !(isValidDictionaryLocked() // TODO: remove the check below && matchesExpectedBinaryDictFormatVersionForThisType(