summaryrefslogtreecommitdiffstats
path: root/core/java/android/content
diff options
context:
space:
mode:
authordcashman <dcashman@google.com>2014-06-09 09:27:54 -0700
committerdcashman <dcashman@google.com>2014-07-14 12:50:51 -0700
commit9d2f441f9bb2c8dcac1150e2cba1d15a86a4efb1 (patch)
tree7ddba4a062aac803b3329dfc311b8f474ea5d677 /core/java/android/content
parenta4ab780877808dbee334f7c7cc4acefa0aa313b2 (diff)
downloadframeworks_base-9d2f441f9bb2c8dcac1150e2cba1d15a86a4efb1.zip
frameworks_base-9d2f441f9bb2c8dcac1150e2cba1d15a86a4efb1.tar.gz
frameworks_base-9d2f441f9bb2c8dcac1150e2cba1d15a86a4efb1.tar.bz2
Initial KeySet API.
Previously submitted but reverted due to doc-compilation bug. Bug: 6967056 Change-Id: I9bd7ef299a4c92c4b327f5b5d7e951f0753b4c8a
Diffstat (limited to 'core/java/android/content')
-rw-r--r--core/java/android/content/pm/IPackageManager.aidl5
-rw-r--r--core/java/android/content/pm/KeySet.java27
-rw-r--r--core/java/android/content/pm/PackageManager.java27
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..91ebbbf 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