diff options
author | dcashman <dcashman@google.com> | 2014-07-12 19:12:15 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-10 20:49:26 +0000 |
commit | d2794789c8ddcdb5876bb7c609438aac6edd2bfe (patch) | |
tree | d3362185d018c7e4dd26b14eeff6ff6a8f2ac0a5 /core/java/android/content | |
parent | 295f2190c51540fe7a2d108ec6c218e9e0a4926a (diff) | |
parent | 405912bce074e9e59a246e2357a108e50dffabf8 (diff) | |
download | frameworks_base-d2794789c8ddcdb5876bb7c609438aac6edd2bfe.zip frameworks_base-d2794789c8ddcdb5876bb7c609438aac6edd2bfe.tar.gz frameworks_base-d2794789c8ddcdb5876bb7c609438aac6edd2bfe.tar.bz2 |
Merge "Initial KeySet API."
Diffstat (limited to 'core/java/android/content')
-rw-r--r-- | core/java/android/content/pm/IPackageManager.aidl | 5 | ||||
-rw-r--r-- | core/java/android/content/pm/KeySet.java | 27 | ||||
-rw-r--r-- | core/java/android/content/pm/PackageManager.java | 27 |
3 files changed, 54 insertions, 5 deletions
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl index 58d3526..3a98f5d 100644 --- a/core/java/android/content/pm/IPackageManager.aidl +++ b/core/java/android/content/pm/IPackageManager.aidl @@ -429,4 +429,9 @@ interface IPackageManager { boolean setBlockUninstallForUser(String packageName, boolean blockUninstall, int userId); boolean getBlockUninstallForUser(String packageName, int userId); + + IBinder getKeySetByAlias(String packageName, String alias); + IBinder getSigningKeySet(String packageName); + boolean isPackageSignedByKeySet(String packageName, IBinder ks); + boolean isPackageSignedByKeySetExactly(String packageName, IBinder ks); } diff --git a/core/java/android/content/pm/KeySet.java b/core/java/android/content/pm/KeySet.java index 0ef09a4..fcdaa18 100644 --- a/core/java/android/content/pm/KeySet.java +++ b/core/java/android/content/pm/KeySet.java @@ -16,19 +16,36 @@ package android.content.pm; -import android.os.Binder; +import android.os.IBinder; -/** @hide */ +/** + * Represents a {@code KeySet} that has been declared in the AndroidManifest.xml + * file for the application. A {@code KeySet} can be used explicitly to + * represent a trust relationship with other applications on the device. + */ public class KeySet { - private Binder token; + private IBinder token; /** @hide */ - public KeySet(Binder token) { + public KeySet(IBinder token) { + if (token == null) { + throw new NullPointerException("null value for KeySet IBinder token"); + } this.token = token; } - Binder getToken() { + /** @hide */ + public IBinder getToken() { return token; } + + @Override + public boolean equals(Object o) { + if (o instanceof KeySet) { + KeySet ks = (KeySet) o; + return token == ks.token; + } + return false; + } }
\ No newline at end of file diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 03d4701..d90c047 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -3602,6 +3602,33 @@ public abstract class PackageManager { public abstract boolean isSafeMode(); /** + * Return the {@link KeySet} associated with the String alias for this + * application. + * + * @param Alias The alias for a given {@link KeySet} as defined in the + * application's AndroidManifest.xml. + */ + public abstract KeySet getKeySetByAlias(String packageName, String alias); + + /** Return the signing {@link KeySet} for this application. */ + public abstract KeySet getSigningKeySet(String packageName); + + /** + * Return whether the package denoted by packageName has been signed by all + * of the keys specified by the {@link KeySet} ks. This will return true if + * the package has been signed by additional keys (a superset) as well. + * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}. + */ + public abstract boolean isSignedBy(String packageName, KeySet ks); + + /** + * Return whether the package denoted by packageName has been signed by all + * of, and only, the keys specified by the {@link KeySet} ks. Compare to + * {@link #isSignedBy(String packageName, KeySet ks)}. + */ + public abstract boolean isSignedByExactly(String packageName, KeySet ks); + + /** * Attempts to move package resources from internal to external media or vice versa. * Since this may take a little while, the result will * be posted back to the given observer. This call may fail if the calling context |