diff options
author | Kenny Root <kroot@google.com> | 2011-09-20 14:15:38 -0700 |
---|---|---|
committer | Kenny Root <kroot@google.com> | 2011-09-20 14:35:10 -0700 |
commit | 3a9b5fbb97e65019abec97f172b4cbf2100d1225 (patch) | |
tree | 7cc787f92fc2071fd8e1050df13c351c616757be | |
parent | ee0835b95de225fdc34d45b777b4595d01727a40 (diff) | |
download | frameworks_base-3a9b5fbb97e65019abec97f172b4cbf2100d1225.zip frameworks_base-3a9b5fbb97e65019abec97f172b4cbf2100d1225.tar.gz frameworks_base-3a9b5fbb97e65019abec97f172b4cbf2100d1225.tar.bz2 |
Unhide new PackageManager APIs for API 14
Change-Id: I83110285ccee39a4cd872a1c2af8357f541833d4
-rw-r--r-- | api/14.txt | 7 | ||||
-rw-r--r-- | api/current.txt | 7 | ||||
-rw-r--r-- | core/java/android/app/ApplicationPackageManager.java | 4 | ||||
-rw-r--r-- | core/java/android/content/Intent.java | 2 | ||||
-rw-r--r-- | core/java/android/content/pm/IPackageManager.aidl | 2 | ||||
-rw-r--r-- | core/java/android/content/pm/PackageManager.java | 32 | ||||
-rw-r--r-- | core/res/res/values/attrs_manifest.xml | 17 | ||||
-rw-r--r-- | core/res/res/values/public.xml | 1 | ||||
-rw-r--r-- | services/java/com/android/server/pm/PackageManagerService.java | 5 | ||||
-rw-r--r-- | test-runner/src/android/test/mock/MockPackageManager.java | 5 |
10 files changed, 59 insertions, 23 deletions
@@ -759,6 +759,7 @@ package android { field public static final int prompt = 16843131; // 0x101017b field public static final int propertyName = 16843489; // 0x10102e1 field public static final int protectionLevel = 16842761; // 0x1010009 + field public static final int publicKey = 16843686; // 0x10103a6 field public static final int queryActionMsg = 16843227; // 0x10101db field public static final int queryAfterZeroResults = 16843394; // 0x1010282 field public static final int queryHint = 16843608; // 0x1010358 @@ -5454,6 +5455,7 @@ package android.content { field public static final java.lang.String ACTION_PACKAGE_FIRST_LAUNCH = "android.intent.action.PACKAGE_FIRST_LAUNCH"; field public static final java.lang.String ACTION_PACKAGE_FULLY_REMOVED = "android.intent.action.PACKAGE_FULLY_REMOVED"; field public static final deprecated java.lang.String ACTION_PACKAGE_INSTALL = "android.intent.action.PACKAGE_INSTALL"; + field public static final java.lang.String ACTION_PACKAGE_NEEDS_VERIFICATION = "android.intent.action.PACKAGE_NEEDS_VERIFICATION"; field public static final java.lang.String ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED"; field public static final java.lang.String ACTION_PACKAGE_REPLACED = "android.intent.action.PACKAGE_REPLACED"; field public static final java.lang.String ACTION_PACKAGE_RESTARTED = "android.intent.action.PACKAGE_RESTARTED"; @@ -6207,11 +6209,13 @@ package android.content.pm { method public abstract void setApplicationEnabledSetting(java.lang.String, int, int); method public abstract void setComponentEnabledSetting(android.content.ComponentName, int, int); method public abstract void setInstallerPackageName(java.lang.String, java.lang.String); + method public abstract void verifyPendingInstall(int, int); field public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0; // 0x0 field public static final int COMPONENT_ENABLED_STATE_DISABLED = 2; // 0x2 field public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3; // 0x3 field public static final int COMPONENT_ENABLED_STATE_ENABLED = 1; // 0x1 field public static final int DONT_KILL_APP = 1; // 0x1 + field public static final java.lang.String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID"; field public static final java.lang.String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency"; field public static final java.lang.String FEATURE_BLUETOOTH = "android.hardware.bluetooth"; field public static final java.lang.String FEATURE_CAMERA = "android.hardware.camera"; @@ -6273,6 +6277,8 @@ package android.content.pm { field public static final int SIGNATURE_NO_MATCH = -3; // 0xfffffffd field public static final int SIGNATURE_SECOND_NOT_SIGNED = -2; // 0xfffffffe field public static final int SIGNATURE_UNKNOWN_PACKAGE = -4; // 0xfffffffc + field public static final int VERIFICATION_ALLOW = 1; // 0x1 + field public static final int VERIFICATION_REJECT = -1; // 0xffffffff } public static class PackageManager.NameNotFoundException extends android.util.AndroidException { @@ -19834,6 +19840,7 @@ package android.test.mock { method public void setApplicationEnabledSetting(java.lang.String, int, int); method public void setComponentEnabledSetting(android.content.ComponentName, int, int); method public void setInstallerPackageName(java.lang.String, java.lang.String); + method public void verifyPendingInstall(int, int); } public class MockResources extends android.content.res.Resources { diff --git a/api/current.txt b/api/current.txt index 45bb882..2fd2b66 100644 --- a/api/current.txt +++ b/api/current.txt @@ -759,6 +759,7 @@ package android { field public static final int prompt = 16843131; // 0x101017b field public static final int propertyName = 16843489; // 0x10102e1 field public static final int protectionLevel = 16842761; // 0x1010009 + field public static final int publicKey = 16843686; // 0x10103a6 field public static final int queryActionMsg = 16843227; // 0x10101db field public static final int queryAfterZeroResults = 16843394; // 0x1010282 field public static final int queryHint = 16843608; // 0x1010358 @@ -5454,6 +5455,7 @@ package android.content { field public static final java.lang.String ACTION_PACKAGE_FIRST_LAUNCH = "android.intent.action.PACKAGE_FIRST_LAUNCH"; field public static final java.lang.String ACTION_PACKAGE_FULLY_REMOVED = "android.intent.action.PACKAGE_FULLY_REMOVED"; field public static final deprecated java.lang.String ACTION_PACKAGE_INSTALL = "android.intent.action.PACKAGE_INSTALL"; + field public static final java.lang.String ACTION_PACKAGE_NEEDS_VERIFICATION = "android.intent.action.PACKAGE_NEEDS_VERIFICATION"; field public static final java.lang.String ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED"; field public static final java.lang.String ACTION_PACKAGE_REPLACED = "android.intent.action.PACKAGE_REPLACED"; field public static final java.lang.String ACTION_PACKAGE_RESTARTED = "android.intent.action.PACKAGE_RESTARTED"; @@ -6207,11 +6209,13 @@ package android.content.pm { method public abstract void setApplicationEnabledSetting(java.lang.String, int, int); method public abstract void setComponentEnabledSetting(android.content.ComponentName, int, int); method public abstract void setInstallerPackageName(java.lang.String, java.lang.String); + method public abstract void verifyPendingInstall(int, int); field public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0; // 0x0 field public static final int COMPONENT_ENABLED_STATE_DISABLED = 2; // 0x2 field public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3; // 0x3 field public static final int COMPONENT_ENABLED_STATE_ENABLED = 1; // 0x1 field public static final int DONT_KILL_APP = 1; // 0x1 + field public static final java.lang.String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID"; field public static final java.lang.String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency"; field public static final java.lang.String FEATURE_BLUETOOTH = "android.hardware.bluetooth"; field public static final java.lang.String FEATURE_CAMERA = "android.hardware.camera"; @@ -6273,6 +6277,8 @@ package android.content.pm { field public static final int SIGNATURE_NO_MATCH = -3; // 0xfffffffd field public static final int SIGNATURE_SECOND_NOT_SIGNED = -2; // 0xfffffffe field public static final int SIGNATURE_UNKNOWN_PACKAGE = -4; // 0xfffffffc + field public static final int VERIFICATION_ALLOW = 1; // 0x1 + field public static final int VERIFICATION_REJECT = -1; // 0xffffffff } public static class PackageManager.NameNotFoundException extends android.util.AndroidException { @@ -19834,6 +19840,7 @@ package android.test.mock { method public void setApplicationEnabledSetting(java.lang.String, int, int); method public void setComponentEnabledSetting(android.content.ComponentName, int, int); method public void setInstallerPackageName(java.lang.String, java.lang.String); + method public void verifyPendingInstall(int, int); } public class MockResources extends android.content.res.Resources { diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java index bd42e34..8ed7481 100644 --- a/core/java/android/app/ApplicationPackageManager.java +++ b/core/java/android/app/ApplicationPackageManager.java @@ -954,9 +954,9 @@ final class ApplicationPackageManager extends PackageManager { } @Override - public void verifyPendingInstall(int id, boolean verified, String failureMessage) { + public void verifyPendingInstall(int id, int response) { try { - mPM.verifyPendingInstall(id, verified, failureMessage); + mPM.verifyPendingInstall(id, response); } catch (RemoteException e) { // Should never happen! } diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index c7698bf..72cf26a 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -1535,8 +1535,6 @@ public class Intent implements Parcelable, Cloneable { * <p class="note"> * This is a protected intent that can only be sent by the system. * </p> - * - * @hide */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_PACKAGE_NEEDS_VERIFICATION = "android.intent.action.PACKAGE_NEEDS_VERIFICATION"; diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl index 5e6e768..a3bcc28 100644 --- a/core/java/android/content/pm/IPackageManager.aidl +++ b/core/java/android/content/pm/IPackageManager.aidl @@ -359,7 +359,7 @@ interface IPackageManager { int flags, in String installerPackageName, in Uri verificationURI, in ManifestDigest manifestDigest); - void verifyPendingInstall(int id, boolean verified, in String message); + void verifyPendingInstall(int id, int verificationCode); VerifierDeviceIdentity getVerifierDeviceIdentity(); } diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index dcb6776..ef7e233 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -725,7 +725,22 @@ public abstract class PackageManager { public static final int MOVE_EXTERNAL_MEDIA = 0x00000002; /** + * Used as the {@code verificationCode} argument for + * {@link PackageManager#verifyPendingInstall} to indicate that the calling + * package verifier allows the installation to proceed. + */ + public static final int VERIFICATION_ALLOW = 1; + + /** + * Used as the {@code verificationCode} argument for + * {@link PackageManager#verifyPendingInstall} to indicate the calling + * package verifier does not vote to allow the installation to proceed. + */ + public static final int VERIFICATION_REJECT = -1; + + /** * Range of IDs allocated for a user. + * * @hide */ public static final int PER_USER_RANGE = 100000; @@ -1045,9 +1060,7 @@ public abstract class PackageManager { /** * Extra field name for the ID of a package pending verification. Passed to * a package verifier and is used to call back to - * {@link PackageManager#verifyPendingInstall(int, boolean)} - * - * @hide + * {@link PackageManager#verifyPendingInstall(int, int)} */ public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID"; @@ -2156,16 +2169,17 @@ public abstract class PackageManager { /** * Allows a package listening to the * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification - * broadcast} to respond to the package manager. + * broadcast} to respond to the package manager. The response must include + * the {@code verificationCode} which is one of + * {@link PackageManager#VERIFICATION_ALLOW} or + * {@link PackageManager#VERIFICATION_REJECT}. * * @param id pending package identifier as passed via the * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra - * @param verified whether the package was verified as valid - * @param failureMessage if verification was false, this is the error - * message that may be shown to the user - * @hide + * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW} + * or {@link PackageManager#VERIFICATION_REJECT}. */ - public abstract void verifyPendingInstall(int id, boolean verified, String failureMessage); + public abstract void verifyPendingInstall(int id, int verificationCode); /** * Change the installer associated with a given package. There are limitations diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index 847afa0..11531fc 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -1561,8 +1561,21 @@ <enum name="xhdpi" value="320" /> </attr> </declare-styleable> - - + + <!-- The attribute that holds a Base64-encoded public key. --> + <attr name="publicKey" format="string" /> + + <!-- Attributes relating to a package verifier --> + <declare-styleable name="AndroidManifestPackageVerifier" parent="AndroidManifest"> + <!-- Specifies the Java-style package name that defines this + package verifier. --> + <attr name="name" /> + + <!-- The Base64 encoded public key of the package verifier's + signature. --> + <attr name="publicKey" /> + </declare-styleable> + <!-- Declaration of an {@link android.content.Intent} object in XML. May also include zero or more {@link #IntentCategory <category> and {@link #Extra <extra>} tags. --> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 848fb8b..97d5afe 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -1768,6 +1768,7 @@ <public type="attr" name="listPreferredItemPaddingLeft" id="0x010103a3" /> <public type="attr" name="listPreferredItemPaddingRight" id="0x010103a4" /> <public type="attr" name="requiresFadingEdge" id="0x010103a5" /> + <public type="attr" name="publicKey" id="0x010103a6" /> <public type="style" name="TextAppearance.SuggestionHighlight" id="0x01030118" /> <public type="style" name="Theme.Holo.Light.DarkActionBar" id="0x01030119" /> diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java index 9ebdd52..105e603 100644 --- a/services/java/com/android/server/pm/PackageManagerService.java +++ b/services/java/com/android/server/pm/PackageManagerService.java @@ -4849,15 +4849,14 @@ public class PackageManagerService extends IPackageManager.Stub { } @Override - public void verifyPendingInstall(int id, boolean verified, String message) + public void verifyPendingInstall(int id, int verificationCode) throws RemoteException { mContext.enforceCallingOrSelfPermission( android.Manifest.permission.PACKAGE_VERIFICATION_AGENT, null); final Message msg = mHandler.obtainMessage(PACKAGE_VERIFIED); msg.arg1 = id; - msg.arg2 = verified ? 1 : 0; - msg.obj = message; + msg.arg2 = verificationCode; mHandler.sendMessage(msg); } diff --git a/test-runner/src/android/test/mock/MockPackageManager.java b/test-runner/src/android/test/mock/MockPackageManager.java index f2fb36f..3525abe 100644 --- a/test-runner/src/android/test/mock/MockPackageManager.java +++ b/test-runner/src/android/test/mock/MockPackageManager.java @@ -546,11 +546,8 @@ public class MockPackageManager extends PackageManager { throw new UnsupportedOperationException(); } - /** - * @hide - */ @Override - public void verifyPendingInstall(int id, boolean verified, String failureMessage) { + public void verifyPendingInstall(int id, int verificationCode) { throw new UnsupportedOperationException(); } |