OSDN Git Service

Add a utility method to InputMethodInfo for FBE.
authorYohei Yukawa <yukawa@google.com>
Mon, 8 Feb 2016 22:05:27 +0000 (14:05 -0800)
committerYohei Yukawa <yukawa@google.com>
Tue, 9 Feb 2016 09:10:27 +0000 (01:10 -0800)
This is another preparation for Bug 26279466.  Whether an input method
is marked to be encryption-aware or not would become the thing here and
there in the Framework code.  Having a utility method and debug info
in dumpsys should make our lives easier.

Bug: 26279466
Change-Id: Icf921fe3661eccf4a589b08b616d05decc561356

core/java/android/view/inputmethod/InputMethodInfo.java

index 281babe..ec2c05e 100644 (file)
@@ -428,12 +428,31 @@ public final class InputMethodInfo implements Parcelable {
         }
     }
 
+    /**
+     * @return {@code true} if the IME is marked to be Encryption-Aware.
+     * @hide
+     */
+    public boolean isEncryptionAware() {
+        if (mService == null || mService.serviceInfo == null ||
+                mService.serviceInfo.applicationInfo == null) {
+            return false;
+        }
+        return mService.serviceInfo.applicationInfo.isEncryptionAware();
+    }
+
     public void dump(Printer pw, String prefix) {
         pw.println(prefix + "mId=" + mId
                 + " mSettingsActivityName=" + mSettingsActivityName
                 + " mSupportsSwitchingToNextInputMethod=" + mSupportsSwitchingToNextInputMethod);
         pw.println(prefix + "mIsDefaultResId=0x"
                 + Integer.toHexString(mIsDefaultResId));
+        if (mService != null && mService.serviceInfo != null &&
+                mService.serviceInfo.applicationInfo != null) {
+            pw.println(" encryptionAware=" +
+                    mService.serviceInfo.applicationInfo.isEncryptionAware());
+        } else {
+            pw.println(" encryptionAware=unknown");
+        }
         pw.println(prefix + "Service:");
         mService.dump(pw, prefix + "  ");
     }