diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-08-12 21:53:24 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-08-12 21:53:24 -0700 |
commit | d0fc3dded203fcd9406914c79ace4abd2b56fe56 (patch) | |
tree | bfcf7ebad35452e0c4aba005ba53356afa4cf542 /core | |
parent | 168173a698e820ceb1ebf54b4910888891be2056 (diff) | |
parent | 766cbfe44be3c5013a6a22bd6cd8ad1055a37256 (diff) | |
download | frameworks_base-d0fc3dded203fcd9406914c79ace4abd2b56fe56.zip frameworks_base-d0fc3dded203fcd9406914c79ace4abd2b56fe56.tar.gz frameworks_base-d0fc3dded203fcd9406914c79ace4abd2b56fe56.tar.bz2 |
Merge change 21044
* changes:
Add new API to compare certs of two UIDs.
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/ApplicationContext.java | 9 | ||||
-rw-r--r-- | core/java/android/content/pm/IPackageManager.aidl | 2 | ||||
-rw-r--r-- | core/java/android/content/pm/PackageManager.java | 29 |
3 files changed, 40 insertions, 0 deletions
diff --git a/core/java/android/app/ApplicationContext.java b/core/java/android/app/ApplicationContext.java index 7e71088..a74fbe4 100644 --- a/core/java/android/app/ApplicationContext.java +++ b/core/java/android/app/ApplicationContext.java @@ -1664,6 +1664,15 @@ class ApplicationContext extends Context { } @Override + public int checkSignatures(int uid1, int uid2) { + try { + return mPM.checkUidSignatures(uid1, uid2); + } catch (RemoteException e) { + throw new RuntimeException("Package manager has died", e); + } + } + + @Override public String[] getPackagesForUid(int uid) { try { return mPM.getPackagesForUid(uid); diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl index d9f298d..7760612 100644 --- a/core/java/android/content/pm/IPackageManager.aidl +++ b/core/java/android/content/pm/IPackageManager.aidl @@ -75,6 +75,8 @@ interface IPackageManager { int checkSignatures(String pkg1, String pkg2); + int checkUidSignatures(int uid1, int uid2); + String[] getPackagesForUid(int uid); String getNameForUid(int uid); diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index bca1715..3a178a1 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -865,6 +865,7 @@ public abstract class PackageManager { * {@link #SIGNATURE_SECOND_NOT_SIGNED}, {@link #SIGNATURE_NO_MATCH}, * or {@link #SIGNATURE_UNKNOWN_PACKAGE}. * + * @see #checkSignatures(int, int) * @see #SIGNATURE_MATCH * @see #SIGNATURE_NEITHER_SIGNED * @see #SIGNATURE_FIRST_NOT_SIGNED @@ -875,6 +876,34 @@ public abstract class PackageManager { public abstract int checkSignatures(String pkg1, String pkg2); /** + * Like {@link #checkSignatures(String, String)}, but takes UIDs of + * the two packages to be checked. This can be useful, for example, + * when doing the check in an IPC, where the UID is the only identity + * available. It is functionally identical to determining the package + * associated with the UIDs and checking their signatures. + * + * @param pkg1 First UID whose signature will be compared. + * @param pkg2 Second UID whose signature will be compared. + * @return Returns an integer indicating whether there is a matching + * signature: the value is >= 0 if there is a match (or neither package + * is signed), or < 0 if there is not a match. The match result can be + * further distinguished with the success (>= 0) constants + * {@link #SIGNATURE_MATCH}, {@link #SIGNATURE_NEITHER_SIGNED}; or + * failure (< 0) constants {@link #SIGNATURE_FIRST_NOT_SIGNED}, + * {@link #SIGNATURE_SECOND_NOT_SIGNED}, {@link #SIGNATURE_NO_MATCH}, + * or {@link #SIGNATURE_UNKNOWN_PACKAGE}. + * + * @see #checkSignatures(int, int) + * @see #SIGNATURE_MATCH + * @see #SIGNATURE_NEITHER_SIGNED + * @see #SIGNATURE_FIRST_NOT_SIGNED + * @see #SIGNATURE_SECOND_NOT_SIGNED + * @see #SIGNATURE_NO_MATCH + * @see #SIGNATURE_UNKNOWN_PACKAGE + */ + public abstract int checkSignatures(int uid1, int uid2); + + /** * Retrieve the names of all packages that are associated with a particular * user id. In most cases, this will be a single package name, the package * that has been assigned that user id. Where there are multiple packages |