From b7197b705bffb82393e38e225f9082205fb26a23 Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Fri, 24 Jan 2014 16:32:28 -0800 Subject: [PATCH] Check length of words for personalization dict. Bug: 12602903 Change-Id: I1ea4e558b6d2fde425ce28226647ad60095e3488 --- .../inputmethod/latin/utils/DictionaryInfoUtils.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java b/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java index b3c787e44..306735779 100644 --- a/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java @@ -26,6 +26,7 @@ import android.util.Log; import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.latin.AssetFileAddress; import com.android.inputmethod.latin.BinaryDictionaryGetter; +import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.makedict.BinaryDictIOUtils; import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader; @@ -368,11 +369,14 @@ public class DictionaryInfoUtils { return dictList; } - @UsedForTesting public static boolean looksValidForDictionaryInsertion(final CharSequence text, final SpacingAndPunctuations spacingAndPunctuations) { if (TextUtils.isEmpty(text)) return false; final int length = text.length(); + // TODO: Make this test "length > Constants.DICTIONARY_MAX_WORD_LENGTH". + if (length >= Constants.DICTIONARY_MAX_WORD_LENGTH) { + return false; + } int i = 0; int digitCount = 0; while (i < length) {