am 95043145: Merge "Check length of words for personalization dict."

* commit '95043145df6d943849f871a80802fc40c5c8ff5b':
  Check length of words for personalization dict.
main
Keisuke Kuroyanagi 2014-01-24 16:47:53 -08:00 committed by Android Git Automerger
commit c9243ca1f7
1 changed files with 5 additions and 1 deletions

View File

@ -26,6 +26,7 @@ import android.util.Log;
import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.latin.AssetFileAddress; import com.android.inputmethod.latin.AssetFileAddress;
import com.android.inputmethod.latin.BinaryDictionaryGetter; import com.android.inputmethod.latin.BinaryDictionaryGetter;
import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.makedict.BinaryDictIOUtils; import com.android.inputmethod.latin.makedict.BinaryDictIOUtils;
import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader; import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader;
@ -368,11 +369,14 @@ public class DictionaryInfoUtils {
return dictList; return dictList;
} }
@UsedForTesting
public static boolean looksValidForDictionaryInsertion(final CharSequence text, public static boolean looksValidForDictionaryInsertion(final CharSequence text,
final SpacingAndPunctuations spacingAndPunctuations) { final SpacingAndPunctuations spacingAndPunctuations) {
if (TextUtils.isEmpty(text)) return false; if (TextUtils.isEmpty(text)) return false;
final int length = text.length(); 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 i = 0;
int digitCount = 0; int digitCount = 0;
while (i < length) { while (i < length) {