From 515c5081352a6b8feaaf570df7ddb6d3676006e7 Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Tue, 9 Dec 2014 19:23:27 +0900 Subject: Quit auto-correct explicit accented letters to base letters. Bug: 7677193 Change-Id: I66eddbf27a9db8682c0347a1be19922792a3bea7 --- java/src/com/android/inputmethod/latin/SuggestedWords.java | 5 +++++ .../src/com/android/inputmethod/latin/utils/AutoCorrectionUtils.java | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java index 30dd51aed..df8db0cd2 100644 --- a/java/src/com/android/inputmethod/latin/SuggestedWords.java +++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java @@ -252,6 +252,7 @@ public class SuggestedWords { public static final int KIND_FLAG_POSSIBLY_OFFENSIVE = 0x80000000; public static final int KIND_FLAG_EXACT_MATCH = 0x40000000; public static final int KIND_FLAG_EXACT_MATCH_WITH_INTENTIONAL_OMISSION = 0x20000000; + public static final int KIND_FLAG_APPROPRIATE_FOR_AUTO_CORRECTION = 0x10000000; public final String mWord; // The completion info from the application. Null for suggestions that don't come from @@ -333,6 +334,10 @@ public class SuggestedWords { return (mKindAndFlags & KIND_FLAG_EXACT_MATCH_WITH_INTENTIONAL_OMISSION) != 0; } + public boolean isAprapreateForAutoCorrection() { + return (mKindAndFlags & KIND_FLAG_APPROPRIATE_FOR_AUTO_CORRECTION) != 0; + } + public void setDebugString(final String str) { if (null == str) throw new NullPointerException("Debug info is null"); mDebugString = str; diff --git a/java/src/com/android/inputmethod/latin/utils/AutoCorrectionUtils.java b/java/src/com/android/inputmethod/latin/utils/AutoCorrectionUtils.java index 2fd257922..c9ecade91 100644 --- a/java/src/com/android/inputmethod/latin/utils/AutoCorrectionUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/AutoCorrectionUtils.java @@ -36,6 +36,10 @@ public final class AutoCorrectionUtils { if (suggestion.isKindOf(SuggestedWordInfo.KIND_WHITELIST)) { return true; } + // TODO: return suggestion.isAprapreateForAutoCorrection(); + if (!suggestion.isAprapreateForAutoCorrection()) { + return false; + } final int autoCorrectionSuggestionScore = suggestion.mScore; // TODO: when the normalized score of the first suggestion is nearly equals to // the normalized score of the second suggestion, behave less aggressive. -- cgit v1.2.3-83-g751a