Merge "Added @UsedForTesting to 'missing' methods to avoid ProGuard removing them"

This commit is contained in:
Adrian Velicu 2014-09-19 05:39:30 +00:00 committed by Android (Google) Code Review
commit bacf2dbac6
5 changed files with 9 additions and 0 deletions

View file

@ -490,6 +490,7 @@ public final class BinaryDictionary extends Dictionary {
return true; return true;
} }
@UsedForTesting
public void addMultipleDictionaryEntries(final LanguageModelParam[] languageModelParams) { public void addMultipleDictionaryEntries(final LanguageModelParam[] languageModelParams) {
if (!isValidDictionary()) return; if (!isValidDictionary()) return;
int processedParamCount = 0; int processedParamCount = 0;

View file

@ -710,6 +710,7 @@ public class DictionaryFacilitator {
getLocale(), personalizationDataChunk, spacingAndPunctuations, callback); getLocale(), personalizationDataChunk, spacingAndPunctuations, callback);
} }
@UsedForTesting
public void addPhraseToContextualDictionary(final String[] phrase, final int probability, public void addPhraseToContextualDictionary(final String[] phrase, final int probability,
final int bigramProbabilityForWords, final int bigramProbabilityForPhrases) { final int bigramProbabilityForWords, final int bigramProbabilityForPhrases) {
// TODO: we're inserting the phrase into the dictionary for the active language. Rethink // TODO: we're inserting the phrase into the dictionary for the active language. Rethink

View file

@ -23,6 +23,7 @@ import android.content.res.Resources;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
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.Constants;
@ -382,6 +383,7 @@ 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;

View file

@ -21,6 +21,7 @@ import java.util.Locale;
import android.view.inputmethod.InputMethodSubtype; import android.view.inputmethod.InputMethodSubtype;
import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.latin.PrevWordsInfo; import com.android.inputmethod.latin.PrevWordsInfo;
public interface DistracterFilter { public interface DistracterFilter {
@ -36,6 +37,7 @@ public interface DistracterFilter {
public boolean isDistracterToWordsInDictionaries(final PrevWordsInfo prevWordsInfo, public boolean isDistracterToWordsInDictionaries(final PrevWordsInfo prevWordsInfo,
final String testedWord, final Locale locale); final String testedWord, final Locale locale);
@UsedForTesting
public int getWordHandlingType(final PrevWordsInfo prevWordsInfo, final String testedWord, public int getWordHandlingType(final PrevWordsInfo prevWordsInfo, final String testedWord,
final Locale locale); final Locale locale);

View file

@ -18,6 +18,7 @@ package com.android.inputmethod.latin.utils;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.latin.Dictionary; import com.android.inputmethod.latin.Dictionary;
import com.android.inputmethod.latin.DictionaryFacilitator; import com.android.inputmethod.latin.DictionaryFacilitator;
import com.android.inputmethod.latin.PrevWordsInfo; import com.android.inputmethod.latin.PrevWordsInfo;
@ -58,12 +59,14 @@ public final class LanguageModelParam {
public final int mTimestamp; public final int mTimestamp;
// Constructor for unigram. TODO: support shortcuts // Constructor for unigram. TODO: support shortcuts
@UsedForTesting
public LanguageModelParam(final CharSequence word, final int unigramProbability, public LanguageModelParam(final CharSequence word, final int unigramProbability,
final int timestamp) { final int timestamp) {
this(null /* word0 */, word, unigramProbability, Dictionary.NOT_A_PROBABILITY, timestamp); this(null /* word0 */, word, unigramProbability, Dictionary.NOT_A_PROBABILITY, timestamp);
} }
// Constructor for unigram and bigram. // Constructor for unigram and bigram.
@UsedForTesting
public LanguageModelParam(final CharSequence word0, final CharSequence word1, public LanguageModelParam(final CharSequence word0, final CharSequence word1,
final int unigramProbability, final int bigramProbability, final int unigramProbability, final int bigramProbability,
final int timestamp) { final int timestamp) {