// Reload enabledSubtypes from the framework. private void updateEnabledSubtypes() { final String currentMode = getCurrentSubtypeMode(); boolean foundCurrentSubtypeBecameDisabled = true; mAllEnabledSubtypesOfCurrentInputMethod = mImm.getEnabledInputMethodSubtypeList(null, true); mEnabledLanguagesOfCurrentInputMethod.clear(); mEnabledKeyboardSubtypesOfCurrentInputMethod.clear(); for (InputMethodSubtypeCompatWrapper ims : mAllEnabledSubtypesOfCurrentInputMethod) { final String locale = getSubtypeLocale(ims); final String mode = ims.getMode(); mLocaleSplitter.setString(locale); if (mLocaleSplitter.hasNext()) { mEnabledLanguagesOfCurrentInputMethod.add(mLocaleSplitter.next()); } if (locale.equals(mInputLocaleStr) && mode.equals(currentMode)) { foundCurrentSubtypeBecameDisabled = false; } if (KEYBOARD_MODE.equals(ims.getMode())) { mEnabledKeyboardSubtypesOfCurrentInputMethod.add(ims); } } mNeedsToDisplayLanguage = !(getEnabledKeyboardLocaleCount() <= 1 && mIsSystemLanguageSameAsInputLanguage); if (foundCurrentSubtypeBecameDisabled) { if (DBG) { Log.w(TAG, "Current subtype: " + mInputLocaleStr + ", " + currentMode); Log.w(TAG, "Last subtype was disabled. Update to the current one."); } updateSubtype(mImm.getCurrentInputMethodSubtype()); } }
public boolean isShortcutImeEnabled() { if (mShortcutInputMethodInfo == null) { 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)) { return true; } } return false; }