diff options
author | satok <satok@google.com> | 2010-11-09 23:31:26 +0900 |
---|---|---|
committer | satok <satok@google.com> | 2010-11-13 10:08:09 +0900 |
commit | 5fd39cafe1de792300e9e3dd60258a1ce5079f73 (patch) | |
tree | d30916af5e6b79b8e6dc9d7de60592b55a300ca9 /src/com | |
parent | 505a0c2ad0210fa24c13e94a779eae41a39510cb (diff) | |
download | packages_apps_settings-5fd39cafe1de792300e9e3dd60258a1ce5079f73.zip packages_apps_settings-5fd39cafe1de792300e9e3dd60258a1ce5079f73.tar.gz packages_apps_settings-5fd39cafe1de792300e9e3dd60258a1ce5079f73.tar.bz2 |
Not to set IME when the current IME was disabled, because framework will find an applicable IME when the current IME was unset.
Bug: 3186000
- This enables us to share the code between Settings and the framework.
- Removed the parameter for lastImeTicked because an applicable IME can be found in the framework.
Change-Id: Icfb6168c5a22506f225bfe58425adeb540835456
Diffstat (limited to 'src/com')
3 files changed, 10 insertions, 34 deletions
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java index 25ab6da..a13a292 100644 --- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java +++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java @@ -52,8 +52,6 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment { final TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':'); - - private String mLastTickedInputMethodId; private AlertDialog mDialog = null; @@ -145,7 +143,6 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment { InputMethodAndSubtypeUtil.loadInputMethodSubtypeList( this, getContentResolver(), mInputMethodProperties); - mLastTickedInputMethodId = null; if (mLanguagePref != null) { Configuration conf = getResources().getConfiguration(); @@ -161,7 +158,7 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment { public void onPause() { super.onPause(); InputMethodAndSubtypeUtil.saveInputMethodSubtypeList(this, getContentResolver(), - mInputMethodProperties, mHaveHardKeyboard, mLastTickedInputMethodId); + mInputMethodProperties, mHaveHardKeyboard); } @Override @@ -184,7 +181,6 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment { selImi = imi; if (isSystemIme(imi)) { // This is a built-in IME, so no need to warn. - mLastTickedInputMethodId = id; return super.onPreferenceTreeClick(preferenceScreen, preference); } } @@ -203,7 +199,6 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment { new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { chkPref.setChecked(true); - mLastTickedInputMethodId = id; } }) @@ -223,8 +218,6 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment { R.string.ime_security_warning, selImi.getServiceInfo().applicationInfo.loadLabel(getPackageManager()))); mDialog.show(); - } else if (id.equals(mLastTickedInputMethodId)) { - mLastTickedInputMethodId = null; } } else if (preference instanceof PreferenceScreen) { if (preference.getFragment() != null) { diff --git a/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java b/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java index 3659dbb..cb90514 100644 --- a/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java +++ b/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java @@ -42,8 +42,6 @@ public class InputMethodAndSubtypeEnabler extends SettingsPreferenceFragment { private List<InputMethodInfo> mInputMethodProperties; - private String mLastTickedInputMethodId; - private AlertDialog mDialog = null; @Override @@ -60,14 +58,13 @@ public class InputMethodAndSubtypeEnabler extends SettingsPreferenceFragment { super.onResume(); InputMethodAndSubtypeUtil.loadInputMethodSubtypeList( this, getContentResolver(), mInputMethodProperties); - mLastTickedInputMethodId = null; } @Override public void onPause() { super.onPause(); InputMethodAndSubtypeUtil.saveInputMethodSubtypeList(this, getContentResolver(), - mInputMethodProperties, mHaveHardKeyboard, mLastTickedInputMethodId); + mInputMethodProperties, mHaveHardKeyboard); } @Override @@ -89,7 +86,6 @@ public class InputMethodAndSubtypeEnabler extends SettingsPreferenceFragment { InputMethodAndSubtypeUtil.setSubtypesPreferenceEnabled( this, mInputMethodProperties, id, true); // This is a built-in IME, so no need to warn. - mLastTickedInputMethodId = id; return super.onPreferenceTreeClick(preferenceScreen, preference); } break; @@ -111,7 +107,6 @@ public class InputMethodAndSubtypeEnabler extends SettingsPreferenceFragment { InputMethodAndSubtypeUtil.setSubtypesPreferenceEnabled( InputMethodAndSubtypeEnabler.this, mInputMethodProperties, id, true); - mLastTickedInputMethodId = id; } }) @@ -132,9 +127,6 @@ public class InputMethodAndSubtypeEnabler extends SettingsPreferenceFragment { selImi.getServiceInfo().applicationInfo.loadLabel(getPackageManager()))); mDialog.show(); } else { - if (id.equals(mLastTickedInputMethodId)) { - mLastTickedInputMethodId = null; - } InputMethodAndSubtypeUtil.setSubtypesPreferenceEnabled( this, mInputMethodProperties, id, false); } diff --git a/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java b/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java index 709dace..288e6c2 100644 --- a/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java +++ b/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java @@ -98,15 +98,13 @@ public class InputMethodAndSubtypeUtil { public static void saveInputMethodSubtypeList( SettingsPreferenceFragment context, ContentResolver resolver, - List<InputMethodInfo> inputMethodProperties, - boolean hasHardKeyboard, String lastTickedInputMethodId) { + List<InputMethodInfo> inputMethodProperties, boolean hasHardKeyboard) { String currentInputMethodId = Settings.Secure.getString(resolver, Settings.Secure.DEFAULT_INPUT_METHOD); final int selectedInputMethodSubtype = getInputMethodSubtypeSelected(resolver); StringBuilder builder = new StringBuilder(); StringBuilder disabledSysImes = new StringBuilder(); - InputMethodInfo firstEnabledIMI = null; int firstSubtypeHashCode = NOT_A_SUBTYPE_ID; final boolean onlyOneIME = inputMethodProperties.size() == 1; @@ -121,9 +119,6 @@ public class InputMethodAndSubtypeUtil { || (pref != null && pref.isChecked())) { if (builder.length() > 0) builder.append(INPUT_METHOD_SEPARATER); builder.append(id); - if (firstEnabledIMI == null) { - firstEnabledIMI = property; - } for (InputMethodSubtype subtype : property.getSubtypes()) { CheckBoxPreference subtypePref = (CheckBoxPreference) context.findPreference( id + subtype.hashCode()); @@ -141,8 +136,11 @@ public class InputMethodAndSubtypeUtil { } else if (isCurrentInputMethod) { // We are processing the current input method, but found that it's not enabled. // This means that the current input method has been uninstalled. - // If currentInputMethod is already uninstalled, selects last ticked IME - currentInputMethodId = lastTickedInputMethodId; + // If currentInputMethod is already uninstalled, InputMethodManagerService will + // find the applicable IME from the history and the system locale. + if (DEBUG) { + Log.d(TAG, "Current IME was uninstalled or disabled."); + } } // If it's a disabled system ime, add it to the disabled list so that it // doesn't get enabled automatically on any changes to the package list @@ -152,15 +150,6 @@ public class InputMethodAndSubtypeUtil { } } - // If the last input method is unset, set it as the first enabled one. - if (TextUtils.isEmpty(currentInputMethodId)) { - if (firstEnabledIMI != null) { - currentInputMethodId = firstEnabledIMI.getId(); - } else { - currentInputMethodId = null; - } - } - if (DEBUG) { Log.d(TAG, "--- Save enabled inputmethod settings. :" + builder.toString()); Log.d(TAG, "--- Save disable system inputmethod settings. :" @@ -183,6 +172,8 @@ public class InputMethodAndSubtypeUtil { Settings.Secure.ENABLED_INPUT_METHODS, builder.toString()); Settings.Secure.putString(resolver, Settings.Secure.DISABLED_SYSTEM_INPUT_METHODS, disabledSysImes.toString()); + // If the current input method is unset, InputMethodManagerService will find the applicable + // IME from the history and the system locale. Settings.Secure.putString(resolver, Settings.Secure.DEFAULT_INPUT_METHOD, currentInputMethodId != null ? currentInputMethodId : ""); } |