Loading java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java +10 −5 Original line number Diff line number Diff line Loading @@ -67,7 +67,6 @@ 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 ALLOW_DUMMY_SUBTYPE = true; private static final boolean HAS_VOICE_FUNCTION = true; private static final String VOICE_MODE = "voice"; private static final String KEYBOARD_MODE = "keyboard"; Loading Loading @@ -119,11 +118,13 @@ 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 (!ALLOW_DUMMY_SUBTYPE) { if (InputMethodServiceCompatWrapper. CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED) { // Returns an empty list return Collections.emptyList(); } // Creates dummy subtypes @SuppressWarnings("unused") List<InputMethodSubtypeCompatWrapper> subtypeList = new ArrayList<InputMethodSubtypeCompatWrapper>(); InputMethodSubtypeCompatWrapper keyboardSubtype = getLastResortSubtype(KEYBOARD_MODE); Loading Loading @@ -159,11 +160,13 @@ public class InputMethodManagerCompatWrapper { getShortcutInputMethodsAndSubtypes() { Object retval = CompatUtils.invoke(mImm, null, METHOD_getShortcutInputMethodsAndSubtypes); if (retval == null || !(retval instanceof Map) || ((Map<?, ?>)retval).isEmpty()) { if (!ALLOW_DUMMY_SUBTYPE) { if (InputMethodServiceCompatWrapper. CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED) { // Returns an empty map return Collections.emptyMap(); } // Creates dummy subtypes @SuppressWarnings("unused") InputMethodInfoCompatWrapper imi = getLatinImeInputMethodInfo(); InputMethodSubtypeCompatWrapper voiceSubtype = getLastResortSubtype(VOICE_MODE); if (imi != null && voiceSubtype != null) { Loading Loading @@ -196,9 +199,11 @@ public class InputMethodManagerCompatWrapper { public void setInputMethodAndSubtype( IBinder token, String id, InputMethodSubtypeCompatWrapper subtype) { if (subtype != null && subtype.hasOriginalObject()) { CompatUtils.invoke(mImm, null, METHOD_setInputMethodAndSubtype, token, id, subtype.getOriginalObject()); } } public boolean switchToLastInputMethod(IBinder token) { if (SubtypeSwitcher.getInstance().isDummyVoiceMode()) { Loading java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ public class InputMethodServiceCompatWrapper extends InputMethodService { // For the API level 11 or later, LatinIME should override onCurrentInputMethodSubtypeChanged(). // For the API level 10 or previous, we handle the "subtype changed" events by ourselves // without having support from framework -- onCurrentInputMethodSubtypeChanged(). private static final boolean CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED = true; public static final boolean CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED = true; private InputMethodManagerCompatWrapper mImm; Loading java/src/com/android/inputmethod/latin/SubtypeSwitcher.java +5 −1 Original line number Diff line number Diff line Loading @@ -382,13 +382,17 @@ public class SubtypeSwitcher { return false; if (mShortcutSubtype == null) return true; // For compatibility, if the shortcut subtype is dummy, we assume the shortcut IME // (built-in voice dummy subtype) is available. if (!mShortcutSubtype.hasOriginalObject()) return true; final boolean allowsImplicitlySelectedSubtypes = true; for (final InputMethodSubtypeCompatWrapper enabledSubtype : mImm.getEnabledInputMethodSubtypeList( mShortcutInputMethodInfo, allowsImplicitlySelectedSubtypes)) { if (enabledSubtype.equals(mShortcutSubtype)) if (enabledSubtype.equals(mShortcutSubtype)) { return true; } } return false; } Loading Loading
java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java +10 −5 Original line number Diff line number Diff line Loading @@ -67,7 +67,6 @@ 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 ALLOW_DUMMY_SUBTYPE = true; private static final boolean HAS_VOICE_FUNCTION = true; private static final String VOICE_MODE = "voice"; private static final String KEYBOARD_MODE = "keyboard"; Loading Loading @@ -119,11 +118,13 @@ 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 (!ALLOW_DUMMY_SUBTYPE) { if (InputMethodServiceCompatWrapper. CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED) { // Returns an empty list return Collections.emptyList(); } // Creates dummy subtypes @SuppressWarnings("unused") List<InputMethodSubtypeCompatWrapper> subtypeList = new ArrayList<InputMethodSubtypeCompatWrapper>(); InputMethodSubtypeCompatWrapper keyboardSubtype = getLastResortSubtype(KEYBOARD_MODE); Loading Loading @@ -159,11 +160,13 @@ public class InputMethodManagerCompatWrapper { getShortcutInputMethodsAndSubtypes() { Object retval = CompatUtils.invoke(mImm, null, METHOD_getShortcutInputMethodsAndSubtypes); if (retval == null || !(retval instanceof Map) || ((Map<?, ?>)retval).isEmpty()) { if (!ALLOW_DUMMY_SUBTYPE) { if (InputMethodServiceCompatWrapper. CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED) { // Returns an empty map return Collections.emptyMap(); } // Creates dummy subtypes @SuppressWarnings("unused") InputMethodInfoCompatWrapper imi = getLatinImeInputMethodInfo(); InputMethodSubtypeCompatWrapper voiceSubtype = getLastResortSubtype(VOICE_MODE); if (imi != null && voiceSubtype != null) { Loading Loading @@ -196,9 +199,11 @@ public class InputMethodManagerCompatWrapper { public void setInputMethodAndSubtype( IBinder token, String id, InputMethodSubtypeCompatWrapper subtype) { if (subtype != null && subtype.hasOriginalObject()) { CompatUtils.invoke(mImm, null, METHOD_setInputMethodAndSubtype, token, id, subtype.getOriginalObject()); } } public boolean switchToLastInputMethod(IBinder token) { if (SubtypeSwitcher.getInstance().isDummyVoiceMode()) { Loading
java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ public class InputMethodServiceCompatWrapper extends InputMethodService { // For the API level 11 or later, LatinIME should override onCurrentInputMethodSubtypeChanged(). // For the API level 10 or previous, we handle the "subtype changed" events by ourselves // without having support from framework -- onCurrentInputMethodSubtypeChanged(). private static final boolean CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED = true; public static final boolean CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED = true; private InputMethodManagerCompatWrapper mImm; Loading
java/src/com/android/inputmethod/latin/SubtypeSwitcher.java +5 −1 Original line number Diff line number Diff line Loading @@ -382,13 +382,17 @@ public class SubtypeSwitcher { return false; if (mShortcutSubtype == null) return true; // For compatibility, if the shortcut subtype is dummy, we assume the shortcut IME // (built-in voice dummy subtype) is available. if (!mShortcutSubtype.hasOriginalObject()) return true; final boolean allowsImplicitlySelectedSubtypes = true; for (final InputMethodSubtypeCompatWrapper enabledSubtype : mImm.getEnabledInputMethodSubtypeList( mShortcutInputMethodInfo, allowsImplicitlySelectedSubtypes)) { if (enabledSubtype.equals(mShortcutSubtype)) if (enabledSubtype.equals(mShortcutSubtype)) { return true; } } return false; } Loading