summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/InputMethodManagerService.java
diff options
context:
space:
mode:
Diffstat (limited to 'services/java/com/android/server/InputMethodManagerService.java')
-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 b5cc5aa6f53c..21c1e8146218 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,