Merge "Return a value for tests instead of saving it"
diff --git a/java/src/com/android/inputmethod/latin/AutoCorrection.java b/java/src/com/android/inputmethod/latin/AutoCorrection.java
index 4ddde87..a9489da 100644
--- a/java/src/com/android/inputmethod/latin/AutoCorrection.java
+++ b/java/src/com/android/inputmethod/latin/AutoCorrection.java
@@ -25,18 +25,16 @@
public class AutoCorrection {
private static final boolean DBG = LatinImeLogger.sDBG;
private static final String TAG = AutoCorrection.class.getSimpleName();
- private boolean mHasAutoCorrection;
private CharSequence mAutoCorrectionWord;
private double mNormalizedScore;
public void init() {
- mHasAutoCorrection = false;
mAutoCorrectionWord = null;
mNormalizedScore = Integer.MIN_VALUE;
}
public boolean hasAutoCorrection() {
- return mHasAutoCorrection;
+ return null != mAutoCorrectionWord;
}
public CharSequence getAutoCorrectionWord() {
@@ -52,15 +50,12 @@
CharSequence typedWord, double autoCorrectionThreshold, int correctionMode,
CharSequence whitelistedWord) {
if (hasAutoCorrectionForWhitelistedWord(whitelistedWord)) {
- mHasAutoCorrection = true;
mAutoCorrectionWord = whitelistedWord;
} else if (hasAutoCorrectionForTypedWord(
dictionaries, wordComposer, suggestions, typedWord, correctionMode)) {
- mHasAutoCorrection = true;
mAutoCorrectionWord = typedWord;
} else if (hasAutoCorrectionForBinaryDictionary(wordComposer, suggestions, correctionMode,
sortedScores, typedWord, autoCorrectionThreshold)) {
- mHasAutoCorrection = true;
mAutoCorrectionWord = suggestions.get(0);
}
return mAutoCorrectionWord;