Use an executor to serialize opening dictionaries.

Bug: 13082957
Change-Id: I25570ab4da94337ed60330c0869fe47657096626
main
Jean Chalard 2014-02-24 21:05:24 +09:00
parent b434acee34
commit 4de2fcdde3
1 changed files with 3 additions and 3 deletions

View File

@ -28,6 +28,7 @@ import com.android.inputmethod.latin.personalization.PersonalizationHelper;
import com.android.inputmethod.latin.personalization.UserHistoryDictionary; import com.android.inputmethod.latin.personalization.UserHistoryDictionary;
import com.android.inputmethod.latin.settings.SettingsValues; import com.android.inputmethod.latin.settings.SettingsValues;
import com.android.inputmethod.latin.utils.CollectionUtils; import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.ExecutorUtils;
import com.android.inputmethod.latin.utils.LanguageModelParam; import com.android.inputmethod.latin.utils.LanguageModelParam;
import java.io.File; import java.io.File;
@ -208,8 +209,7 @@ public class DictionaryFacilitatorForSuggest {
if (listener != null) { if (listener != null) {
listener.onUpdateMainDictionaryAvailability(hasMainDictionary()); listener.onUpdateMainDictionaryAvailability(hasMainDictionary());
} }
new Thread("InitializeBinaryDictionary") { ExecutorUtils.getExecutor("InitializeBinaryDictionary").execute(new Runnable() {
@Override
public void run() { public void run() {
final DictionaryCollection newMainDict = final DictionaryCollection newMainDict =
DictionaryFactory.createMainDictionaryFromManager(context, locale); DictionaryFactory.createMainDictionaryFromManager(context, locale);
@ -219,7 +219,7 @@ public class DictionaryFacilitatorForSuggest {
} }
mLatchForWaitingLoadingMainDictionary.countDown(); mLatchForWaitingLoadingMainDictionary.countDown();
} }
}.start(); });
} }
// The main dictionary could have been loaded asynchronously. Don't cache the return value // The main dictionary could have been loaded asynchronously. Don't cache the return value