summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorsatok <satok@google.com>2011-01-17 21:14:46 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-01-17 21:14:46 -0800
commitca0f49ed6e79423b5fa946935dbefa7269dce02a (patch)
tree5b025ad31598b72d7e5a0dca6d91459b650def35 /services
parent5d92aff192975283fc97ed199af9f85f819ae462 (diff)
parentd871343dbbde38f25ac0b41155e2f9d2dd7aadca (diff)
downloadframeworks_base-ca0f49ed6e79423b5fa946935dbefa7269dce02a.zip
frameworks_base-ca0f49ed6e79423b5fa946935dbefa7269dce02a.tar.gz
frameworks_base-ca0f49ed6e79423b5fa946935dbefa7269dce02a.tar.bz2
Merge "Fix the algorithm to get current input method subtype considering explicitly and implicitly enabled subtypes." into honeycomb
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/InputMethodManagerService.java28
1 files changed, 21 insertions, 7 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index 7b4f246..4d40620 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -2049,8 +2049,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
for (int i = 0; i < N; ++i) {
InputMethodSubtype subtype = subtypes.get(i);
final String subtypeLocale = subtype.getLocale();
- // An applicable subtype should match "mode".
- if (subtypes.get(i).getMode().equalsIgnoreCase(mode)) {
+ // An applicable subtype should match "mode". If mode is null, mode will be ignored,
+ // and all subtypes with all modes can be candidates.
+ if (mode == null || subtypes.get(i).getMode().equalsIgnoreCase(mode)) {
if (firstMatchedModeSubtype == null) {
firstMatchedModeSubtype = subtype;
}
@@ -2175,11 +2176,24 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
InputMethodInfo imi = mMethodMap.get(lastInputMethodId);
if (imi != null) {
// If there are no selected subtypes, the framework will try to find
- // the most applicable subtype from all subtypes whose mode is
- // SUBTYPE_MODE_KEYBOARD. This is an exceptional case, so we will hardcode
- // the mode.
- mCurrentSubtype = findLastResortApplicableSubtypeLocked(
- mRes, imi.getSubtypes(), SUBTYPE_MODE_KEYBOARD, null, true);
+ // the most applicable subtype from explicitly or implicitly enabled
+ // subtypes.
+ List<InputMethodSubtype> explicitlyOrImplicitlyEnabledSubtypes =
+ getEnabledInputMethodSubtypeList(imi, true);
+ // If there is only one explicitly or implicitly enabled subtype,
+ // just returns it.
+ if (explicitlyOrImplicitlyEnabledSubtypes.size() == 1) {
+ mCurrentSubtype = explicitlyOrImplicitlyEnabledSubtypes.get(0);
+ } else if (explicitlyOrImplicitlyEnabledSubtypes.size() > 1) {
+ mCurrentSubtype = findLastResortApplicableSubtypeLocked(
+ mRes, explicitlyOrImplicitlyEnabledSubtypes,
+ SUBTYPE_MODE_KEYBOARD, null, true);
+ if (mCurrentSubtype == null) {
+ mCurrentSubtype = findLastResortApplicableSubtypeLocked(
+ mRes, explicitlyOrImplicitlyEnabledSubtypes, null, null,
+ true);
+ }
+ }
}
} else {
mCurrentSubtype =