diff options
author | satok <satok@google.com> | 2011-10-10 00:59:41 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-10-10 00:59:41 -0700 |
commit | af8139ee9b97c031e5b45ac9f1175ef4794c39ee (patch) | |
tree | 33c35fe1387c17829d715c4b0abf83bc61f31b05 | |
parent | f6497e45fae88788b1c67d815458355a1f2f65b5 (diff) | |
parent | dc9ddaee9a710cf6f5d7f37350650f82e706c706 (diff) | |
download | frameworks_base-af8139ee9b97c031e5b45ac9f1175ef4794c39ee.zip frameworks_base-af8139ee9b97c031e5b45ac9f1175ef4794c39ee.tar.gz frameworks_base-af8139ee9b97c031e5b45ac9f1175ef4794c39ee.tar.bz2 |
Merge "Fix the behavior for choosing new default IME not to choose an auxiliary IME as the default IME"
-rw-r--r-- | services/java/com/android/server/InputMethodManagerService.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 3e1fb9f..6ddbf5a 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -574,7 +574,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } if (defIm == null && mMethodList.size() > 0) { - defIm = mMethodList.get(0); + defIm = getMostApplicableDefaultIMELocked(); Slog.i(TAG, "No default found, using " + defIm.getId()); } if (defIm != null) { @@ -1925,19 +1925,26 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return subtypes; } - private boolean chooseNewDefaultIMELocked() { + private InputMethodInfo getMostApplicableDefaultIMELocked() { List<InputMethodInfo> enabled = mSettings.getEnabledInputMethodListLocked(); if (enabled != null && enabled.size() > 0) { // We'd prefer to fall back on a system IME, since that is safer. int i=enabled.size(); while (i > 0) { i--; - if ((enabled.get(i).getServiceInfo().applicationInfo.flags - & ApplicationInfo.FLAG_SYSTEM) != 0) { + final InputMethodInfo imi = enabled.get(i); + if (isSystemIme(imi) && !imi.isAuxiliaryIme()) { break; } } - InputMethodInfo imi = enabled.get(i); + return enabled.get(i); + } + return null; + } + + private boolean chooseNewDefaultIMELocked() { + final InputMethodInfo imi = getMostApplicableDefaultIMELocked(); + if (imi != null) { if (DEBUG) { Slog.d(TAG, "New default IME was selected: " + imi.getId()); } |