diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 28d3b44378921afa4d224abf8d5a49b1876da414..4dee4f3b4adf684cb2b4636e049001163ddea212 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -437,13 +437,20 @@ public class Suggest implements Dictionary.WordCallback { } // Don't auto-correct words with multiple capital letter autoCorrectionAvailable &= !wordComposer.isMostlyCaps(); + final boolean shouldBlockAutoCorrectionBySatefyNet; + if (allowsToBeAutoCorrected && scoreInfoList.size() > 1 && mAutoCorrectionThreshold > 0 + && Suggest.shouldBlockAutoCorrectionBySafetyNet(typedWord, + scoreInfoList.get(1).mWord)) { + shouldBlockAutoCorrectionBySatefyNet = true; + } else { + shouldBlockAutoCorrectionBySatefyNet = false; + } builder = new SuggestedWords.Builder(scoreInfoList, !allowsToBeAutoCorrected /* typedWordValid */, autoCorrectionAvailable /* hasMinimalSuggestion */, allowsToBeAutoCorrected /* allowsToBeAutoCorrected */, false /* isPunctuationSuggestions */); - if (allowsToBeAutoCorrected && builder.size() > 1 && mAutoCorrectionThreshold > 0 - && Suggest.shouldBlockAutoCorrectionBySafetyNet(typedWord, builder.getWord(1))) { + if (shouldBlockAutoCorrectionBySatefyNet) { builder.setShouldBlockAutoCorrectionBySafetyNet(); } return builder; diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java index feb26db5a51913030e59befbde3dc1681bc55efd..bc89941a12c8b8a1b30a5de3f556cf7232d1e2b4 100644 --- a/java/src/com/android/inputmethod/latin/SuggestedWords.java +++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java @@ -170,7 +170,7 @@ public class SuggestedWords { } public static class SuggestedWordInfo { - private final CharSequence mWord; + public final CharSequence mWord; private final CharSequence mDebugString; private final boolean mPreviousSuggestedWord;