Merge "Add an API supportsSwitchingToNextInput" into klp-dev
diff --git a/api/current.txt b/api/current.txt
index 5a3c7db..2f0d64c 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -1015,6 +1015,7 @@
field public static final int summaryOff = 16843248; // 0x10101f0
field public static final int summaryOn = 16843247; // 0x10101ef
field public static final int supportsRtl = 16843695; // 0x10103af
+ field public static final int supportsSwitchingToNextInputMethod = 16843753; // 0x10103e9
field public static final int supportsUploading = 16843419; // 0x101029b
field public static final int switchMinWidth = 16843632; // 0x1010370
field public static final int switchPadding = 16843633; // 0x1010371
diff --git a/core/java/android/view/inputmethod/InputMethodInfo.java b/core/java/android/view/inputmethod/InputMethodInfo.java
index feaab3ea..c440c7b 100644
--- a/core/java/android/view/inputmethod/InputMethodInfo.java
+++ b/core/java/android/view/inputmethod/InputMethodInfo.java
@@ -82,11 +82,16 @@
private final boolean mIsAuxIme;
/**
- * Cavert: mForceDefault must be false for production. This flag is only for test.
+ * Caveat: mForceDefault must be false for production. This flag is only for test.
*/
private final boolean mForceDefault;
/**
+ * The flag whether this IME supports ways to switch to a next input method (e.g. globe key.)
+ */
+ private final boolean mSupportsSwitchingToNextInputMethod;
+
+ /**
* Constructor.
*
* @param context The Context in which we are parsing the input method.
@@ -114,6 +119,7 @@
ServiceInfo si = service.serviceInfo;
mId = new ComponentName(si.packageName, si.name).flattenToShortString();
boolean isAuxIme = true;
+ boolean supportsSwitchingToNextInputMethod = false; // false as default
mForceDefault = false;
PackageManager pm = context.getPackageManager();
@@ -149,6 +155,9 @@
com.android.internal.R.styleable.InputMethod_settingsActivity);
isDefaultResId = sa.getResourceId(
com.android.internal.R.styleable.InputMethod_isDefault, 0);
+ supportsSwitchingToNextInputMethod = sa.getBoolean(
+ com.android.internal.R.styleable.InputMethod_supportsSwitchingToNextInputMethod,
+ false);
sa.recycle();
final int depth = parser.getDepth();
@@ -216,6 +225,7 @@
mSettingsActivityName = settingsActivityComponent;
mIsDefaultResId = isDefaultResId;
mIsAuxIme = isAuxIme;
+ mSupportsSwitchingToNextInputMethod = supportsSwitchingToNextInputMethod;
}
InputMethodInfo(Parcel source) {
@@ -223,6 +233,7 @@
mSettingsActivityName = source.readString();
mIsDefaultResId = source.readInt();
mIsAuxIme = source.readInt() == 1;
+ mSupportsSwitchingToNextInputMethod = source.readInt() == 1;
mService = ResolveInfo.CREATOR.createFromParcel(source);
source.readTypedList(mSubtypes, InputMethodSubtype.CREATOR);
mForceDefault = false;
@@ -254,6 +265,7 @@
mSubtypes.addAll(subtypes);
}
mForceDefault = forceDefault;
+ mSupportsSwitchingToNextInputMethod = true;
}
private static ResolveInfo buildDummyResolveInfo(String packageName, String className,
@@ -435,6 +447,14 @@
}
/**
+ * @return true if this input method supports ways to switch to a next input method.
+ * @hide
+ */
+ public boolean supportsSwitchingToNextInputMethod() {
+ return mSupportsSwitchingToNextInputMethod;
+ }
+
+ /**
* Used to package this object into a {@link Parcel}.
*
* @param dest The {@link Parcel} to be written.
@@ -446,6 +466,7 @@
dest.writeString(mSettingsActivityName);
dest.writeInt(mIsDefaultResId);
dest.writeInt(mIsAuxIme ? 1 : 0);
+ dest.writeInt(mSupportsSwitchingToNextInputMethod ? 1 : 0);
mService.writeToParcel(dest, flags);
dest.writeTypedList(mSubtypes);
}
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 03e9045..50ea08b 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2378,6 +2378,9 @@
<!-- Set to true in all of the configurations for which this input
method should be considered an option as the default. -->
<attr name="isDefault" format="boolean" />
+ <!-- Set to true if this input method supports ways to switch to
+ a next input method (e.g. a globe key.). -->
+ <attr name="supportsSwitchingToNextInputMethod" format="boolean" />
</declare-styleable>
<!-- This is the subtype of InputMethod. Subtype can describe locales (e.g. en_US, fr_FR...)
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 80c9184..f2ec04f 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2072,5 +2072,6 @@
<public type="attr" name="isAsciiCapable" />
<public type="attr" name="customRoots" />
<public type="attr" name="autoMirrored" />
+ <public type="attr" name="supportsSwitchingToNextInputMethod" />
</resources>