diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index b30d1e35cde62f64b8e8fb5526e095ee1848c325..ddf21f749876233f44df218ef43dcad641f0c221 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -442,9 +442,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen loadSettings(); - mImm.setAdditionalInputMethodSubtypes( - SubtypeUtils.getInputMethodId(getPackageName()), - mSettingsValues.getPrefefinedAdditionalSubtypes()); + SubtypeUtils.setAditionalInputMethodSubtypes( + this, mSettingsValues.getPrefefinedAdditionalSubtypes()); // TODO: remove the following when it's not needed by updateCorrectionMode() any more mInputAttributes = new InputAttributes(null, false /* isFullscreenMode */); diff --git a/java/src/com/android/inputmethod/latin/SubtypeUtils.java b/java/src/com/android/inputmethod/latin/SubtypeUtils.java index 4d0f1c262832a7cdd6df66bb92df80e959cc6924..a361027afda18f042768de173797a76dbf251927 100644 --- a/java/src/com/android/inputmethod/latin/SubtypeUtils.java +++ b/java/src/com/android/inputmethod/latin/SubtypeUtils.java @@ -146,4 +146,14 @@ public class SubtypeUtils { throw new RuntimeException("Can't find subtype for locale " + localeString + " and keyboard layout " + keyoardLayoutSet); } + + public static void setAditionalInputMethodSubtypes(Context context, + InputMethodSubtype[] subtypes) { + final InputMethodManagerCompatWrapper imm = InputMethodManagerCompatWrapper.getInstance(); + if (imm == null) { + throw new RuntimeException("Input method manager not found"); + } + final String imiId = getInputMethodId(context.getPackageName()); + imm.setAdditionalInputMethodSubtypes(imiId, subtypes); + } }