mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Create DictionaryStats in executor.
Bug: 16553957 Change-Id: Ie4e9a6ee67f90ba0086af2075068e078efc7f189
This commit is contained in:
parent
f88ec161e9
commit
c724864c61
@ -27,6 +27,7 @@ import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
|
||||
import com.android.inputmethod.latin.makedict.WordProperty;
|
||||
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
|
||||
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.DistracterFilter;
|
||||
import com.android.inputmethod.latin.utils.ExecutorUtils;
|
||||
@ -645,13 +646,15 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
||||
|
||||
public DictionaryStats getDictionaryStats() {
|
||||
reloadDictionaryIfRequired();
|
||||
mLock.readLock().lock();
|
||||
try {
|
||||
// TODO: Get stats form the dictionary.
|
||||
return new DictionaryStats(mLocale, mDictName, mDictFile);
|
||||
} finally {
|
||||
mLock.readLock().unlock();
|
||||
}
|
||||
final AsyncResultHolder<DictionaryStats> result = new AsyncResultHolder<>();
|
||||
asyncExecuteTaskWithLock(mLock.readLock(), mDictName /* executorName */, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO: Get stats from the dictionary.
|
||||
result.set(new DictionaryStats(mLocale, mDictName, mDictFile));
|
||||
}
|
||||
});
|
||||
return result.get(null /* defaultValue */, TIMEOUT_FOR_READ_OPS_IN_MILLISECONDS);
|
||||
}
|
||||
|
||||
@UsedForTesting
|
||||
|
Loading…
Reference in New Issue
Block a user