Use isAuxiliary instead of ExtraValue for the auxiliary subtypes.
Change-Id: Ibce4f884e697ca789b9942cf3abad43741040a87
diff --git a/api/current.txt b/api/current.txt
index 7dcb714..1e90e47 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -526,6 +526,7 @@
field public static final int installLocation = 16843447; // 0x10102b7
field public static final int interpolator = 16843073; // 0x1010141
field public static final int isAlwaysSyncable = 16843571; // 0x1010333
+ field public static final int isAuxiliary = 16843641; // 0x1010379
field public static final int isDefault = 16843297; // 0x1010221
field public static final int isIndicator = 16843079; // 0x1010147
field public static final int isModifier = 16843334; // 0x1010246
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index b82a2d2..bbbca37 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2137,6 +2137,11 @@
string will be passed to the IME when the framework calls the IME with the
subtype. -->
<attr name="imeSubtypeMode" format="string" />
+ <!-- Set true if the subtype is auxiliary. An auxiliary subtype won't be shown in the
+ input method selection list in the settings app.
+ InputMethodManager#switchToLastInputMethod will ignore auxiliary subtypes when it
+ chooses a target subtype. -->
+ <attr name="isAuxiliary" format="boolean" />
<!-- The extra value of the subtype. This string can be any string and will be passed to
the IME when the framework calls the IME with the subtype. -->
<attr name="imeSubtypeExtraValue" format="string" />
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 0bd939ed..5f72da5 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1685,4 +1685,5 @@
<public type="attr" name="layout_columnSpan" />
<public type="attr" name="layout_columnWeight" />
+ <public type="attr" name="isAuxiliary" />
</resources>
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index 465fd2e..c96273b 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -126,10 +126,6 @@
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;
@@ -1883,7 +1879,8 @@
final int subtypeCount = imi.getSubtypeCount();
for (int j = 0; j < subtypeCount; ++j) {
InputMethodSubtype subtype = imi.getSubtypeAt(j);
- if (enabledSubtypeSet.contains(String.valueOf(subtype.hashCode()))) {
+ if (enabledSubtypeSet.contains(String.valueOf(subtype.hashCode()))
+ && !subtype.isAuxiliary()) {
final CharSequence title;
int nameResId = subtype.getNameResId();
String mode = subtype.getMode();
@@ -2078,7 +2075,7 @@
private boolean canAddToLastInputMethod(InputMethodSubtype subtype) {
if (subtype == null) return true;
- return !subtype.containsExtraValueKey(SUBTYPE_EXTRAVALUE_EXCLUDE_FROM_LAST_IME);
+ return !subtype.isAuxiliary();
}
private void saveCurrentInputMethodAndSubtypeToHistory() {