am 4426cbc5: Fix: contacts/user dicts are too frequently regenerated.

* commit '4426cbc59ed026c07da2d1a91e8057562c304d58':
  Fix: contacts/user dicts are too frequently regenerated.
main
Keisuke Kuroyanagi 2014-04-28 14:14:56 +00:00 committed by Android Git Automerger
commit 3fbbeea650
1 changed files with 3 additions and 2 deletions

View File

@ -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(