Add a function to check auxiliary ime.
Change-Id: Ibda3d0a11c7dd77aa1304d34fc858bb7d941c626
This commit is contained in:
@@ -77,6 +77,8 @@ public final class InputMethodInfo implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
private final ArrayList<InputMethodSubtype> mSubtypes = new ArrayList<InputMethodSubtype>();
|
private final ArrayList<InputMethodSubtype> mSubtypes = new ArrayList<InputMethodSubtype>();
|
||||||
|
|
||||||
|
private boolean mIsAuxIme;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
@@ -104,6 +106,7 @@ public final class InputMethodInfo implements Parcelable {
|
|||||||
mService = service;
|
mService = service;
|
||||||
ServiceInfo si = service.serviceInfo;
|
ServiceInfo si = service.serviceInfo;
|
||||||
mId = new ComponentName(si.packageName, si.name).flattenToShortString();
|
mId = new ComponentName(si.packageName, si.name).flattenToShortString();
|
||||||
|
mIsAuxIme = true;
|
||||||
|
|
||||||
PackageManager pm = context.getPackageManager();
|
PackageManager pm = context.getPackageManager();
|
||||||
String settingsActivityComponent = null;
|
String settingsActivityComponent = null;
|
||||||
@@ -167,6 +170,9 @@ public final class InputMethodInfo implements Parcelable {
|
|||||||
.InputMethod_Subtype_isAuxiliary, false),
|
.InputMethod_Subtype_isAuxiliary, false),
|
||||||
a.getBoolean(com.android.internal.R.styleable
|
a.getBoolean(com.android.internal.R.styleable
|
||||||
.InputMethod_Subtype_overridesImplicitlyEnabledSubtype, false));
|
.InputMethod_Subtype_overridesImplicitlyEnabledSubtype, false));
|
||||||
|
if (!subtype.isAuxiliary()) {
|
||||||
|
mIsAuxIme = false;
|
||||||
|
}
|
||||||
mSubtypes.add(subtype);
|
mSubtypes.add(subtype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -177,6 +183,10 @@ public final class InputMethodInfo implements Parcelable {
|
|||||||
if (parser != null) parser.close();
|
if (parser != null) parser.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mSubtypes.size() == 0) {
|
||||||
|
mIsAuxIme = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (additionalSubtypesMap != null && additionalSubtypesMap.containsKey(mId)) {
|
if (additionalSubtypesMap != null && additionalSubtypesMap.containsKey(mId)) {
|
||||||
final List<InputMethodSubtype> additionalSubtypes = additionalSubtypesMap.get(mId);
|
final List<InputMethodSubtype> additionalSubtypes = additionalSubtypesMap.get(mId);
|
||||||
final int N = additionalSubtypes.size();
|
final int N = additionalSubtypes.size();
|
||||||
@@ -195,6 +205,7 @@ public final class InputMethodInfo implements Parcelable {
|
|||||||
mId = source.readString();
|
mId = source.readString();
|
||||||
mSettingsActivityName = source.readString();
|
mSettingsActivityName = source.readString();
|
||||||
mIsDefaultResId = source.readInt();
|
mIsDefaultResId = source.readInt();
|
||||||
|
mIsAuxIme = source.readInt() == 1;
|
||||||
mService = ResolveInfo.CREATOR.createFromParcel(source);
|
mService = ResolveInfo.CREATOR.createFromParcel(source);
|
||||||
source.readTypedList(mSubtypes, InputMethodSubtype.CREATOR);
|
source.readTypedList(mSubtypes, InputMethodSubtype.CREATOR);
|
||||||
}
|
}
|
||||||
@@ -220,6 +231,7 @@ public final class InputMethodInfo implements Parcelable {
|
|||||||
mId = new ComponentName(si.packageName, si.name).flattenToShortString();
|
mId = new ComponentName(si.packageName, si.name).flattenToShortString();
|
||||||
mSettingsActivityName = settingsActivity;
|
mSettingsActivityName = settingsActivity;
|
||||||
mIsDefaultResId = 0;
|
mIsDefaultResId = 0;
|
||||||
|
mIsAuxIme = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -360,16 +372,25 @@ public final class InputMethodInfo implements Parcelable {
|
|||||||
return mId.hashCode();
|
return mId.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public boolean isAuxiliaryIme() {
|
||||||
|
return mIsAuxIme;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to package this object into a {@link Parcel}.
|
* Used to package this object into a {@link Parcel}.
|
||||||
*
|
*
|
||||||
* @param dest The {@link Parcel} to be written.
|
* @param dest The {@link Parcel} to be written.
|
||||||
* @param flags The flags used for parceling.
|
* @param flags The flags used for parceling.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
dest.writeString(mId);
|
dest.writeString(mId);
|
||||||
dest.writeString(mSettingsActivityName);
|
dest.writeString(mSettingsActivityName);
|
||||||
dest.writeInt(mIsDefaultResId);
|
dest.writeInt(mIsDefaultResId);
|
||||||
|
dest.writeInt(mIsAuxIme ? 1 : 0);
|
||||||
mService.writeToParcel(dest, flags);
|
mService.writeToParcel(dest, flags);
|
||||||
dest.writeTypedList(mSubtypes);
|
dest.writeTypedList(mSubtypes);
|
||||||
}
|
}
|
||||||
@@ -379,15 +400,18 @@ public final class InputMethodInfo implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public static final Parcelable.Creator<InputMethodInfo> CREATOR
|
public static final Parcelable.Creator<InputMethodInfo> CREATOR
|
||||||
= new Parcelable.Creator<InputMethodInfo>() {
|
= new Parcelable.Creator<InputMethodInfo>() {
|
||||||
|
@Override
|
||||||
public InputMethodInfo createFromParcel(Parcel source) {
|
public InputMethodInfo createFromParcel(Parcel source) {
|
||||||
return new InputMethodInfo(source);
|
return new InputMethodInfo(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public InputMethodInfo[] newArray(int size) {
|
public InputMethodInfo[] newArray(int size) {
|
||||||
return new InputMethodInfo[size];
|
return new InputMethodInfo[size];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
public int describeContents() {
|
public int describeContents() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user