summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorrich cannings <richc@google.com>2012-08-22 14:28:05 -0700
committerrich cannings <richc@google.com>2012-08-23 15:39:02 -0700
commitd9ef3e5495db1c46bcfcc1a2d4386af8db6deb0c (patch)
tree9b78fc4eb2e237ee7ad49eb70cc558f871ff9a48 /core/java
parentbb121d569cd6bc7bf4018ef12756247009988863 (diff)
Allow verifiers to extend timeout
Create a new verifier API to extend the timeout for a giving package, including the resulting action (allow or deny) upon the timeout occuring. Bug: 6901038 Change-Id: I351f7944327f863aff1d7dd1227be74652fa1511
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ApplicationPackageManager.java10
-rw-r--r--core/java/android/content/pm/IPackageManager.aidl1
-rw-r--r--core/java/android/content/pm/PackageManager.java35
3 files changed, 46 insertions, 0 deletions
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index 86ee8a024016..f3f75ce4a6bd 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -1006,6 +1006,16 @@ final class ApplicationPackageManager extends PackageManager {
}
@Override
+ public void extendVerificationTimeout(int id, int verificationCodeAtTimeout,
+ long millisecondsToDelay) {
+ try {
+ mPM.extendVerificationTimeout(id, verificationCodeAtTimeout, millisecondsToDelay);
+ } catch (RemoteException e) {
+ // Should never happen!
+ }
+ }
+
+ @Override
public void setInstallerPackageName(String targetPackage,
String installerPackageName) {
try {
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 3f4b994f99d9..0be8b83ae407 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -370,6 +370,7 @@ interface IPackageManager {
in ContainerEncryptionParams encryptionParams);
void verifyPendingInstall(int id, int verificationCode);
+ void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay);
VerifierDeviceIdentity getVerifierDeviceIdentity();
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 0461dd14ab79..b3e98e73615f 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -762,6 +762,14 @@ public abstract class PackageManager {
public static final int VERIFICATION_REJECT = -1;
/**
+ * Can be used as the {@code millisecondsToDelay} argument for
+ * {@link PackageManager#extendVerificationTimeout}. This is the
+ * maximum time {@code PackageManager} waits for the verification
+ * agent to return (in milliseconds).
+ */
+ public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000;
+
+ /**
* Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's
* audio pipeline is low-latency, more suitable for audio applications sensitive to delays or
* lag in sound input or output.
@@ -2274,6 +2282,33 @@ public abstract class PackageManager {
public abstract void verifyPendingInstall(int id, int verificationCode);
/**
+ * Allows a package listening to the
+ * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
+ * broadcast} to extend the default timeout for a response and declare what
+ * action to perform after the timeout occurs. The response must include
+ * the {@code verificationCodeAtTimeout} which is one of
+ * {@link PackageManager#VERIFICATION_ALLOW} or
+ * {@link PackageManager#VERIFICATION_REJECT}.
+ *
+ * This method may only be called once per package id. Additional calls
+ * will have no effect.
+ *
+ * @param id pending package identifier as passed via the
+ * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra
+ * @param verificationCodeAtTimeout either
+ * {@link PackageManager#VERIFICATION_ALLOW} or
+ * {@link PackageManager#VERIFICATION_REJECT}.
+ * @param millisecondsToDelay the amount of time requested for the timeout.
+ * Must be positive and less than
+ * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}.
+ *
+ * @throws IllegalArgumentException if {@code millisecondsToDelay} is out
+ * of bounds or {@code verificationCodeAtTimeout} is unknown.
+ */
+ public abstract void extendVerificationTimeout(int id,
+ int verificationCodeAtTimeout, long millisecondsToDelay);
+
+ /**
* Change the installer associated with a given package. There are limitations
* on how the installer package can be changed; in particular:
* <ul>