summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorrich cannings <richc@google.com>2012-07-26 14:07:53 -0700
committerrich cannings <richc@google.com>2012-08-02 11:26:47 -0700
commit24713907fe4632d263aea82f7a35c8fb08918a09 (patch)
treefbf80caed2388c579d64b20b86b9b9f2586b1640 /cmds
parent26ea2e5df58edfd14717c86854f6bb99975b6a77 (diff)
downloadframeworks_base-24713907fe4632d263aea82f7a35c8fb08918a09.zip
frameworks_base-24713907fe4632d263aea82f7a35c8fb08918a09.tar.gz
frameworks_base-24713907fe4632d263aea82f7a35c8fb08918a09.tar.bz2
Pass URLs to package verifiers
This change passes the originating URL and accompanied referrer to package verifiers, when available. Bug: 6544677 Change-Id: If9ff6663ad7f3426b7aea2aceb1413b689788138
Diffstat (limited to 'cmds')
-rw-r--r--cmds/pm/src/com/android/commands/pm/Pm.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java
index 4cb5270..4311c06 100644
--- a/cmds/pm/src/com/android/commands/pm/Pm.java
+++ b/cmds/pm/src/com/android/commands/pm/Pm.java
@@ -782,6 +782,7 @@ public final class Pm {
String macAlgo = null;
byte[] macKey = null;
byte[] tag = null;
+ String referrer = null;
while ((opt=nextOption()) != null) {
if (opt.equals("-l")) {
@@ -845,6 +846,13 @@ public final class Pm {
showUsage();
return;
}
+ } else if (opt.equals("--referrer")) {
+ referrer = nextOptionData();
+ if (referrer == null) {
+ System.err.println("Error: must supply argument for --referrer");
+ showUsage();
+ return;
+ }
} else {
System.err.println("Error: Unknown option: " + opt);
showUsage();
@@ -892,6 +900,13 @@ public final class Pm {
final Uri apkURI;
final Uri verificationURI;
+ final Uri referrerURI;
+
+ if (referrer != null) {
+ referrerURI = Uri.parse(referrer);
+ } else {
+ referrerURI = null;
+ }
// Populate apkURI, must be present
final String apkFilePath = nextArg();
@@ -916,7 +931,7 @@ public final class Pm {
PackageInstallObserver obs = new PackageInstallObserver();
try {
mPm.installPackageWithVerification(apkURI, obs, installFlags, installerPackageName,
- verificationURI, null, encryptionParams);
+ verificationURI, null, encryptionParams, apkURI, referrerURI);
synchronized (obs) {
while (!obs.finished) {
@@ -1436,7 +1451,8 @@ public final class Pm {
System.err.println(" pm list libraries");
System.err.println(" pm path PACKAGE");
System.err.println(" pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] [-s] [-f]");
- System.err.println(" [--algo <algorithm name> --key <key-in-hex> --iv <IV-in-hex>] PATH");
+ System.err.println(" [--algo <algorithm name> --key <key-in-hex> --iv <IV-in-hex>]");
+ System.err.println(" [--referrer <URI>] PATH");
System.err.println(" pm uninstall [-k] PACKAGE");
System.err.println(" pm clear PACKAGE");
System.err.println(" pm enable PACKAGE_OR_COMPONENT");