Create DictionaryStats in executor.
Bug: 16553957 Change-Id: Ie4e9a6ee67f90ba0086af2075068e078efc7f189
This commit is contained in:
parent
f88ec161e9
commit
c724864c61
1 changed files with 10 additions and 7 deletions
|
@ -27,6 +27,7 @@ import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
|
||||||
import com.android.inputmethod.latin.makedict.WordProperty;
|
import com.android.inputmethod.latin.makedict.WordProperty;
|
||||||
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
|
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
|
||||||
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
|
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
|
||||||
|
import com.android.inputmethod.latin.utils.AsyncResultHolder;
|
||||||
import com.android.inputmethod.latin.utils.CombinedFormatUtils;
|
import com.android.inputmethod.latin.utils.CombinedFormatUtils;
|
||||||
import com.android.inputmethod.latin.utils.DistracterFilter;
|
import com.android.inputmethod.latin.utils.DistracterFilter;
|
||||||
import com.android.inputmethod.latin.utils.ExecutorUtils;
|
import com.android.inputmethod.latin.utils.ExecutorUtils;
|
||||||
|
@ -645,13 +646,15 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
||||||
|
|
||||||
public DictionaryStats getDictionaryStats() {
|
public DictionaryStats getDictionaryStats() {
|
||||||
reloadDictionaryIfRequired();
|
reloadDictionaryIfRequired();
|
||||||
mLock.readLock().lock();
|
final AsyncResultHolder<DictionaryStats> result = new AsyncResultHolder<>();
|
||||||
try {
|
asyncExecuteTaskWithLock(mLock.readLock(), mDictName /* executorName */, new Runnable() {
|
||||||
// TODO: Get stats form the dictionary.
|
@Override
|
||||||
return new DictionaryStats(mLocale, mDictName, mDictFile);
|
public void run() {
|
||||||
} finally {
|
// TODO: Get stats from the dictionary.
|
||||||
mLock.readLock().unlock();
|
result.set(new DictionaryStats(mLocale, mDictName, mDictFile));
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
return result.get(null /* defaultValue */, TIMEOUT_FOR_READ_OPS_IN_MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
@UsedForTesting
|
||||||
|
|
Loading…
Reference in a new issue