@Override
  public void onResume() {
    super.onResume();

    mSettingsObserver.resume();
    mIm.registerInputDeviceListener(this, null);

    if (!mIsOnlyImeSettings) {
      if (mLanguagePref != null) {
        Configuration conf = getResources().getConfiguration();
        String language = conf.locale.getLanguage();
        String localeString;
        // TODO: This is not an accurate way to display the locale, as it is
        // just working around the fact that we support limited dialects
        // and want to pretend that the language is valid for all locales.
        // We need a way to support languages that aren't tied to a particular
        // locale instead of hiding the locale qualifier.
        if (hasOnlyOneLanguageInstance(language, Resources.getSystem().getAssets().getLocales())) {
          localeString = conf.locale.getDisplayLanguage(conf.locale);
        } else {
          localeString = conf.locale.getDisplayName(conf.locale);
        }
        if (localeString.length() > 1) {
          localeString = Character.toUpperCase(localeString.charAt(0)) + localeString.substring(1);
          mLanguagePref.setSummary(localeString);
        }
      }

      updateUserDictionaryPreference(findPreference(KEY_USER_DICTIONARY_SETTINGS));
      if (SHOW_INPUT_METHOD_SWITCHER_SETTINGS) {
        mShowInputMethodSelectorPref.setOnPreferenceChangeListener(this);
      }
    }

    if (mStatusBarImeSwitcher != null) {
      mStatusBarImeSwitcher.setChecked(
          Settings.System.getInt(
                  getActivity().getContentResolver(), Settings.System.STATUS_BAR_IME_SWITCHER, 1)
              != 0);
    }

    // Hard keyboard
    if (!mHardKeyboardPreferenceList.isEmpty()) {
      for (int i = 0; i < sHardKeyboardKeys.length; ++i) {
        CheckBoxPreference chkPref =
            (CheckBoxPreference) mHardKeyboardCategory.findPreference(sHardKeyboardKeys[i]);
        chkPref.setChecked(System.getInt(getContentResolver(), sSystemSettingNames[i], 1) > 0);
      }
    }

    updateInputDevices();

    // IME
    InputMethodAndSubtypeUtil.loadInputMethodSubtypeList(this, getContentResolver(), mImis, null);
    updateActiveInputMethodsSummary();
  }