aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2014-06-10 05:17:35 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-06-10 05:17:35 +0000
commit61ce0c7ef0457cec390ccdee3d67df6aa3a8adc5 (patch)
treee9f219cab250918ea498137d2f2e23ebe1e79337 /java/src
parent307d316f19c4387d4c121e8f8f3941fea09da6a1 (diff)
parent1ffb7cd4481bb7ea6d364a26e658d0b930dd3a1b (diff)
downloadlatinime-61ce0c7ef0457cec390ccdee3d67df6aa3a8adc5.tar.gz
latinime-61ce0c7ef0457cec390ccdee3d67df6aa3a8adc5.tar.xz
latinime-61ce0c7ef0457cec390ccdee3d67df6aa3a8adc5.zip
am 1ffb7cd4: Merge "Debug log when failed to add/remove n-gram entry."
* commit '1ffb7cd4481bb7ea6d364a26e658d0b930dd3a1b': Debug log when failed to add/remove n-gram entry.
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java17
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);
+ }
+ }
}
});
}