am dbfba856: Add a function to check auxiliary ime.

* commit 'dbfba8560dda9de810c4265b765d49952519e841':
  Add a function to check auxiliary ime.
diff --git a/core/java/android/view/inputmethod/InputMethodInfo.java b/core/java/android/view/inputmethod/InputMethodInfo.java
index 0119d03..131f0ae 100644
--- a/core/java/android/view/inputmethod/InputMethodInfo.java
+++ b/core/java/android/view/inputmethod/InputMethodInfo.java
@@ -77,6 +77,8 @@
      */
     private final ArrayList<InputMethodSubtype> mSubtypes = new ArrayList<InputMethodSubtype>();
 
+    private boolean mIsAuxIme;
+
     /**
      * Constructor.
      *
@@ -104,6 +106,7 @@
         mService = service;
         ServiceInfo si = service.serviceInfo;
         mId = new ComponentName(si.packageName, si.name).flattenToShortString();
+        mIsAuxIme = true;
 
         PackageManager pm = context.getPackageManager();
         String settingsActivityComponent = null;
@@ -167,6 +170,9 @@
                                     .InputMethod_Subtype_isAuxiliary, false),
                             a.getBoolean(com.android.internal.R.styleable
                                     .InputMethod_Subtype_overridesImplicitlyEnabledSubtype, false));
+                    if (!subtype.isAuxiliary()) {
+                        mIsAuxIme = false;
+                    }
                     mSubtypes.add(subtype);
                 }
             }
@@ -177,6 +183,10 @@
             if (parser != null) parser.close();
         }
 
+        if (mSubtypes.size() == 0) {
+            mIsAuxIme = false;
+        }
+
         if (additionalSubtypesMap != null && additionalSubtypesMap.containsKey(mId)) {
             final List<InputMethodSubtype> additionalSubtypes = additionalSubtypesMap.get(mId);
             final int N = additionalSubtypes.size();
@@ -195,6 +205,7 @@
         mId = source.readString();
         mSettingsActivityName = source.readString();
         mIsDefaultResId = source.readInt();
+        mIsAuxIme = source.readInt() == 1;
         mService = ResolveInfo.CREATOR.createFromParcel(source);
         source.readTypedList(mSubtypes, InputMethodSubtype.CREATOR);
     }
@@ -220,6 +231,7 @@
         mId = new ComponentName(si.packageName, si.name).flattenToShortString();
         mSettingsActivityName = settingsActivity;
         mIsDefaultResId = 0;
+        mIsAuxIme = false;
     }
 
     /**
@@ -361,15 +373,24 @@
     }
 
     /**
+     * @hide
+     */
+    public boolean isAuxiliaryIme() {
+        return mIsAuxIme;
+    }
+
+    /**
      * Used to package this object into a {@link Parcel}.
      * 
      * @param dest The {@link Parcel} to be written.
      * @param flags The flags used for parceling.
      */
+    @Override
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeString(mId);
         dest.writeString(mSettingsActivityName);
         dest.writeInt(mIsDefaultResId);
+        dest.writeInt(mIsAuxIme ? 1 : 0);
         mService.writeToParcel(dest, flags);
         dest.writeTypedList(mSubtypes);
     }
@@ -379,15 +400,18 @@
      */
     public static final Parcelable.Creator<InputMethodInfo> CREATOR
             = new Parcelable.Creator<InputMethodInfo>() {
+        @Override
         public InputMethodInfo createFromParcel(Parcel source) {
             return new InputMethodInfo(source);
         }
 
+        @Override
         public InputMethodInfo[] newArray(int size) {
             return new InputMethodInfo[size];
         }
     };
 
+    @Override
     public int describeContents() {
         return 0;
     }