From 69da2690e5a990987adba8f68dcf3d8a17d1a0fc Mon Sep 17 00:00:00 2001 From: Satoshi Kataoka Date: Thu, 15 Aug 2013 15:36:44 +0900 Subject: [PATCH] Add an API supportsSwitchingToNextInput To let the system know an IME supports switching to a next input method Bug: 8364845 Change-Id: Iabf4f106893ee6a262ad0cd44dbec0c661bf0ff2 --- api/current.txt | 1 + .../view/inputmethod/InputMethodInfo.java | 23 ++++++++++++++++++- core/res/res/values/attrs.xml | 3 +++ core/res/res/values/public.xml | 1 + 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/api/current.txt b/api/current.txt index 394369511e31e..c6e782a5653ab 100644 --- a/api/current.txt +++ b/api/current.txt @@ -1015,6 +1015,7 @@ package android { 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 feaab3ea036a1..c440c7bd40c2e 100644 --- a/core/java/android/view/inputmethod/InputMethodInfo.java +++ b/core/java/android/view/inputmethod/InputMethodInfo.java @@ -82,10 +82,15 @@ public final class InputMethodInfo implements Parcelable { 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. * @@ -114,6 +119,7 @@ public final class InputMethodInfo implements Parcelable { 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 @@ public final class InputMethodInfo implements Parcelable { 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 @@ public final class InputMethodInfo implements Parcelable { mSettingsActivityName = settingsActivityComponent; mIsDefaultResId = isDefaultResId; mIsAuxIme = isAuxIme; + mSupportsSwitchingToNextInputMethod = supportsSwitchingToNextInputMethod; } InputMethodInfo(Parcel source) { @@ -223,6 +233,7 @@ public final class InputMethodInfo implements Parcelable { 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 @@ public final class InputMethodInfo implements Parcelable { mSubtypes.addAll(subtypes); } mForceDefault = forceDefault; + mSupportsSwitchingToNextInputMethod = true; } private static ResolveInfo buildDummyResolveInfo(String packageName, String className, @@ -434,6 +446,14 @@ public final class InputMethodInfo implements Parcelable { return mIsAuxIme; } + /** + * @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}. * @@ -446,6 +466,7 @@ public final class InputMethodInfo implements Parcelable { 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 03e9045680315..50ea08b4cdf0b 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -2378,6 +2378,9 @@ + +