aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java11
-rw-r--r--java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java8
-rw-r--r--java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatWrapper.java4
-rw-r--r--java/src/com/android/inputmethod/latin/SuggestedWords.java8
4 files changed, 20 insertions, 11 deletions
diff --git a/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java b/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
index 0c2a58ea9..d99f40765 100644
--- a/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
+++ b/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
@@ -67,7 +67,8 @@ public class InputMethodManagerCompatWrapper {
// For the compatibility, IMM will create dummy subtypes if subtypes are not found.
// This is required to be false if the current behavior is broken. For now, it's ok to be true.
- private static final boolean HAS_VOICE_FUNCTION = true;
+ public static final boolean FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES =
+ !InputMethodServiceCompatWrapper.CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED;
private static final String VOICE_MODE = "voice";
private static final String KEYBOARD_MODE = "keyboard";
@@ -118,8 +119,7 @@ public class InputMethodManagerCompatWrapper {
Object retval = CompatUtils.invoke(mImm, null, METHOD_getEnabledInputMethodSubtypeList,
(imi != null ? imi.getInputMethodInfo() : null), allowsImplicitlySelectedSubtypes);
if (retval == null || !(retval instanceof List) || ((List<?>)retval).isEmpty()) {
- if (InputMethodServiceCompatWrapper.
- CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED) {
+ if (!FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES) {
// Returns an empty list
return Collections.emptyList();
}
@@ -148,7 +148,7 @@ public class InputMethodManagerCompatWrapper {
@SuppressWarnings("unused")
private InputMethodSubtypeCompatWrapper getLastResortSubtype(String mode) {
- if (VOICE_MODE.equals(mode) && !HAS_VOICE_FUNCTION)
+ if (VOICE_MODE.equals(mode) && !FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES)
return null;
Locale inputLocale = SubtypeSwitcher.getInstance().getInputLocale();
if (inputLocale == null)
@@ -160,8 +160,7 @@ public class InputMethodManagerCompatWrapper {
getShortcutInputMethodsAndSubtypes() {
Object retval = CompatUtils.invoke(mImm, null, METHOD_getShortcutInputMethodsAndSubtypes);
if (retval == null || !(retval instanceof Map) || ((Map<?, ?>)retval).isEmpty()) {
- if (InputMethodServiceCompatWrapper.
- CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED) {
+ if (!FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES) {
// Returns an empty map
return Collections.emptyMap();
}
diff --git a/java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java b/java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java
index d6afd06c5..828aea41f 100644
--- a/java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java
+++ b/java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java
@@ -47,11 +47,17 @@ public class InputMethodServiceCompatWrapper extends InputMethodService {
@SuppressWarnings("unused")
public void notifyOnCurrentInputMethodSubtypeChanged(InputMethodSubtypeCompatWrapper subtype) {
// Do nothing when the API level is 11 or later
- if (CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED) return;
+ // and FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES is not true
+ if (CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED && !InputMethodManagerCompatWrapper.
+ FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES) {
+ return;
+ }
if (subtype == null) {
subtype = mImm.getCurrentInputMethodSubtype();
}
if (subtype != null) {
+ if (!InputMethodManagerCompatWrapper.FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES
+ && !subtype.isDummy()) return;
if (!InputMethodManagerCompatWrapper.SUBTYPE_SUPPORTED) {
LanguageSwitcherProxy.getInstance().setLocale(subtype.getLocale());
}
diff --git a/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatWrapper.java b/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatWrapper.java
index 86c8af37f..806c355a9 100644
--- a/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatWrapper.java
+++ b/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatWrapper.java
@@ -116,6 +116,10 @@ public final class InputMethodSubtypeCompatWrapper extends AbstractCompatWrapper
return (String)CompatUtils.invoke(mObj, null, METHOD_getExtraValueOf, key);
}
+ public boolean isDummy() {
+ return !hasOriginalObject();
+ }
+
@Override
public boolean equals(Object o) {
if (o instanceof InputMethodSubtypeCompatWrapper) {
diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java
index fe7aac7c2..a8cdfc02e 100644
--- a/java/src/com/android/inputmethod/latin/SuggestedWords.java
+++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java
@@ -32,14 +32,14 @@ public class SuggestedWords {
public final List<SuggestedWordInfo> mSuggestedWordInfoList;
private SuggestedWords(List<CharSequence> words, boolean typedWordValid,
- boolean hasMinamlSuggestion, List<SuggestedWordInfo> suggestedWordInfoList) {
+ boolean hasMinimalSuggestion, List<SuggestedWordInfo> suggestedWordInfoList) {
if (words != null) {
mWords = words;
} else {
mWords = Collections.emptyList();
}
mTypedWordValid = typedWordValid;
- mHasMinimalSuggestion = hasMinamlSuggestion;
+ mHasMinimalSuggestion = hasMinimalSuggestion;
mSuggestedWordInfoList = suggestedWordInfoList;
}
@@ -113,8 +113,8 @@ public class SuggestedWords {
return this;
}
- public Builder setHasMinimalSuggestion(boolean hasMinamlSuggestion) {
- mHasMinimalSuggestion = hasMinamlSuggestion;
+ public Builder setHasMinimalSuggestion(boolean hasMinimalSuggestion) {
+ mHasMinimalSuggestion = hasMinimalSuggestion;
return this;
}