Entirely remove safety net memory.

mHasAutoCorrectionCandidate now includes the fact that this
did not get caught by the safety net. This is more intuitive.

Change-Id: I6502bbf1ca64a0a6d64f55d723305cf78352a656
main
Jean Chalard 2012-03-09 22:02:26 +09:00
parent 68823ae08e
commit 1a85b74adb
1 changed files with 4 additions and 8 deletions

View File

@ -33,7 +33,6 @@ public class SuggestedWords {
public final boolean mTypedWordValid; public final boolean mTypedWordValid;
public final boolean mHasAutoCorrectionCandidate; public final boolean mHasAutoCorrectionCandidate;
public final boolean mIsPunctuationSuggestions; public final boolean mIsPunctuationSuggestions;
private final boolean mShouldBlockAutoCorrectionBySafetyNet;
private final List<SuggestedWordInfo> mSuggestedWordInfoList; private final List<SuggestedWordInfo> mSuggestedWordInfoList;
SuggestedWords(List<CharSequence> words, boolean typedWordValid, SuggestedWords(List<CharSequence> words, boolean typedWordValid,
@ -46,9 +45,9 @@ public class SuggestedWords {
mWords = Collections.emptyList(); mWords = Collections.emptyList();
} }
mTypedWordValid = typedWordValid; mTypedWordValid = typedWordValid;
mHasAutoCorrectionCandidate = hasAutoCorrectionCandidate; mHasAutoCorrectionCandidate = hasAutoCorrectionCandidate
&& !shouldBlockAutoCorrectionBySafetyNet;
mIsPunctuationSuggestions = isPunctuationSuggestions; mIsPunctuationSuggestions = isPunctuationSuggestions;
mShouldBlockAutoCorrectionBySafetyNet = shouldBlockAutoCorrectionBySafetyNet;
mSuggestedWordInfoList = suggestedWordInfoList; mSuggestedWordInfoList = suggestedWordInfoList;
} }
@ -65,13 +64,11 @@ public class SuggestedWords {
} }
public boolean hasAutoCorrectionWord() { public boolean hasAutoCorrectionWord() {
return !mShouldBlockAutoCorrectionBySafetyNet return mHasAutoCorrectionCandidate && size() > 1 && !mTypedWordValid;
&& mHasAutoCorrectionCandidate && size() > 1 && !mTypedWordValid;
} }
public boolean willAutoCorrect() { public boolean willAutoCorrect() {
return !mTypedWordValid && mHasAutoCorrectionCandidate return !mTypedWordValid && mHasAutoCorrectionCandidate;
&& !mShouldBlockAutoCorrectionBySafetyNet;
} }
@Override @Override
@ -81,7 +78,6 @@ public class SuggestedWords {
+ " mTypedWordValid=" + mTypedWordValid + " mTypedWordValid=" + mTypedWordValid
+ " mHasAutoCorrectionCandidate=" + mHasAutoCorrectionCandidate + " mHasAutoCorrectionCandidate=" + mHasAutoCorrectionCandidate
+ " mIsPunctuationSuggestions=" + mIsPunctuationSuggestions + " mIsPunctuationSuggestions=" + mIsPunctuationSuggestions
+ " mShouldBlockAutoCorrectionBySafetyNet=" + mShouldBlockAutoCorrectionBySafetyNet
+ " mWords=" + Arrays.toString(mWords.toArray()); + " mWords=" + Arrays.toString(mWords.toArray());
} }