diff options
author | 2014-06-10 13:04:57 +0900 | |
---|---|---|
committer | 2014-06-10 13:04:57 +0900 | |
commit | 354a59dfa47a839727c628aadab1e146d541335f (patch) | |
tree | 6786c73a01352cabc699d3ceb971f7def0c78004 /java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java | |
parent | 43ea8f6e774c46f8285657020d02202e447bba78 (diff) | |
download | latinime-354a59dfa47a839727c628aadab1e146d541335f.tar.gz latinime-354a59dfa47a839727c628aadab1e146d541335f.tar.xz latinime-354a59dfa47a839727c628aadab1e146d541335f.zip |
Debug log when failed to add/remove n-gram entry.
Change-Id: Ibf0a4e01e1abc81b09aec104ba39d2ec18f4db8b
Diffstat (limited to 'java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java index e5e00d59a..cf61855b3 100644 --- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java @@ -49,6 +49,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; * queries in native code. This binary dictionary is written to internal storage. */ abstract public class ExpandableBinaryDictionary extends Dictionary { + private static final boolean DEBUG = false; /** Used for Log actions from this class */ private static final String TAG = ExpandableBinaryDictionary.class.getSimpleName(); @@ -325,16 +326,17 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { protected void addNgramEntryLocked(final PrevWordsInfo prevWordsInfo, final String word, final int frequency, final int timestamp) { if (!mBinaryDictionary.addNgramEntry(prevWordsInfo, word, frequency, timestamp)) { - Log.e(TAG, "Cannot add n-gram entry."); - Log.e(TAG, " PrevWordsInfo: " + prevWordsInfo); - Log.e(TAG, " word: " + word); + if (DEBUG) { + Log.i(TAG, "Cannot add n-gram entry."); + Log.i(TAG, " PrevWordsInfo: " + prevWordsInfo + ", word: " + word); + } } } /** * Dynamically remove the n-gram entry in the dictionary. */ - public void removeNgramDynamically(final PrevWordsInfo prevWordsInfo, final String word1) { + public void removeNgramDynamically(final PrevWordsInfo prevWordsInfo, final String word) { reloadDictionaryIfRequired(); asyncExecuteTaskWithWriteLock(new Runnable() { @Override @@ -343,7 +345,12 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { return; } runGCIfRequiredLocked(true /* mindsBlockByGC */); - mBinaryDictionary.removeNgramEntry(prevWordsInfo, word1); + if (!mBinaryDictionary.removeNgramEntry(prevWordsInfo, word)) { + if (DEBUG) { + Log.i(TAG, "Cannot remove n-gram entry."); + Log.i(TAG, " PrevWordsInfo: " + prevWordsInfo + ", word: " + word); + } + } } }); } |