public void loadKeyboard(final EditorInfo editorInfo, final SettingsValues settingsValues) {
   final KeyboardLayoutSet.Builder builder =
       new KeyboardLayoutSet.Builder(mThemeContext, editorInfo);
   final Resources res = mThemeContext.getResources();
   final int keyboardWidth = ResourceUtils.getDefaultKeyboardWidth(res);
   final int keyboardHeight = ResourceUtils.getDefaultKeyboardHeight(res);
   builder.setKeyboardGeometry(keyboardWidth, keyboardHeight);
   builder.setSubtype(mSubtypeSwitcher.getCurrentSubtype());
   builder.setOptions(
       settingsValues.isVoiceKeyEnabled(editorInfo),
       true /* always show a voice key on the main keyboard */,
       settingsValues.isLanguageSwitchKeyEnabled());
   mKeyboardLayoutSet = builder.build();
   try {
     mState.onLoadKeyboard();
   } catch (KeyboardLayoutSetException e) {
     Log.w(TAG, "loading keyboard failed: " + e.mKeyboardId, e.getCause());
     LatinImeLogger.logOnException(e.mKeyboardId.toString(), e.getCause());
     return;
   }
 }
 /** Updates state machine to figure out when to automatically switch back to the previous mode. */
 public void onCodeInput(final int code) {
   mState.onCodeInput(code, mLatinIME.getCurrentAutoCapsState());
 }
 // Implements {@link KeyboardState.SwitchActions}.
 @Override
 public void requestUpdatingShiftState() {
   mState.onUpdateShiftState(
       mLatinIME.getCurrentAutoCapsState(), mLatinIME.getCurrentRecapitalizeState());
 }
 public void onFinishSlidingInput() {
   mState.onFinishSlidingInput();
 }
 public void onReleaseKey(final int code, final boolean withSliding) {
   mState.onReleaseKey(code, withSliding);
 }
 public void onPressKey(final int code, final boolean isSinglePointer) {
   mState.onPressKey(code, isSinglePointer, mLatinIME.getCurrentAutoCapsState());
 }
 // TODO: Remove this method. Come up with a more comprehensive way to reset the keyboard layout
 // when a keyboard layout set doesn't get reloaded in LatinIME.onStartInputViewInternal().
 public void resetKeyboardStateToAlphabet() {
   mState.onResetKeyboardStateToAlphabet();
 }
 /** Update keyboard shift state triggered by connected EditText status change. */
 public void updateShiftState() {
   mState.onUpdateShiftState(
       mLatinIME.getCurrentAutoCapsState(), mLatinIME.getCurrentRecapitalizeState());
 }
 public void saveKeyboardState() {
   if (getKeyboard() != null || isShowingEmojiPalettes()) {
     mState.onSaveKeyboardState();
   }
 }