Fix: Read lock is wrongly used for gutSuggestions.

Bug: 9737865

Change-Id: I017f80b46c5dc48c40f2de7c4d516a042992feb4
This commit is contained in:
Keisuke Kuroynagi 2013-07-09 17:38:35 +09:00 committed by Keisuke Kuroyanagi
parent 58b2a6372f
commit cfbb7fbd48

View file

@ -196,7 +196,8 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
final String prevWord, final ProximityInfo proximityInfo, final String prevWord, final ProximityInfo proximityInfo,
final boolean blockOffensiveWords) { final boolean blockOffensiveWords) {
asyncReloadDictionaryIfRequired(); asyncReloadDictionaryIfRequired();
if (mLocalDictionaryController.readLock().tryLock()) { // Write lock because getSuggestions in native updates session status.
if (mLocalDictionaryController.writeLock().tryLock()) {
try { try {
final ArrayList<SuggestedWordInfo> inMemDictSuggestion = final ArrayList<SuggestedWordInfo> inMemDictSuggestion =
mDictionaryWriter.getSuggestions(composer, prevWord, proximityInfo, mDictionaryWriter.getSuggestions(composer, prevWord, proximityInfo,
@ -217,7 +218,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
return inMemDictSuggestion; return inMemDictSuggestion;
} }
} finally { } finally {
mLocalDictionaryController.readLock().unlock(); mLocalDictionaryController.writeLock().unlock();
} }
} }
return null; return null;