summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorsatok <satok@google.com>2011-01-25 00:11:47 +0900
committersatok <satok@google.com>2011-01-25 00:52:53 +0900
commit57ffc00239edcfe733832771e1429fca20182207 (patch)
tree1698e6deb57a849aac26d3a39a2ed55a03918836 /services
parent9c265fcc846699050bee169f60defff4f5a73b5c (diff)
downloadframeworks_base-57ffc00239edcfe733832771e1429fca20182207.zip
frameworks_base-57ffc00239edcfe733832771e1429fca20182207.tar.gz
frameworks_base-57ffc00239edcfe733832771e1429fca20182207.tar.bz2
Add a way that subtype will be excluded from a last input method
Bug: 3382702 - Added SUBTYPE_EXTRAVALUE_EXCLUDE_FROM_LAST_IME and if subtype has this extra value, It will be excluded from a last input method which will be called from switchToLastInputMethod Change-Id: I03ae10e07f978dcc3a83dd77b10613048dce7f22
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/InputMethodManagerService.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index b5cc5aa..21c1e81 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -121,6 +121,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
private static final String SUBTYPE_MODE_KEYBOARD = "keyboard";
private static final String SUBTYPE_MODE_VOICE = "voice";
+ // TODO: Will formalize this value as API
+ private static final String SUBTYPE_EXTRAVALUE_EXCLUDE_FROM_LAST_IME =
+ "excludeFromLastInputMethod";
+
final Context mContext;
final Resources mRes;
final Handler mHandler;
@@ -1901,12 +1905,26 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
}
+ private boolean canAddToLastInputMethod(InputMethodSubtype subtype) {
+ if (subtype == null) return true;
+ String[] extraValues = subtype.getExtraValue().split(",");
+ final int N = extraValues.length;
+ for (int i = 0; i < N; ++i) {
+ if (SUBTYPE_EXTRAVALUE_EXCLUDE_FROM_LAST_IME.equals(extraValues[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
private void saveCurrentInputMethodAndSubtypeToHistory() {
String subtypeId = NOT_A_SUBTYPE_ID_STR;
if (mCurrentSubtype != null) {
subtypeId = String.valueOf(mCurrentSubtype.hashCode());
}
- mSettings.addSubtypeToHistory(mCurMethodId, subtypeId);
+ if (canAddToLastInputMethod(mCurrentSubtype)) {
+ mSettings.addSubtypeToHistory(mCurMethodId, subtypeId);
+ }
}
private void setSelectedInputMethodAndSubtypeLocked(InputMethodInfo imi, int subtypeId,