summaryrefslogtreecommitdiffstats
path: root/cmds/pm
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2014-05-29 11:51:59 +0100
committerNarayan Kamath <narayan@google.com>2014-06-03 11:11:47 +0100
commit6431d11cd420536aaa9d93ae510a3151ccc4df1d (patch)
tree880f75d4410e2a8cd8c1edf29297b8b14b561669 /cmds/pm
parent032c5c054c331b63f2d45ee9c497ac852faec633 (diff)
downloadframeworks_base-6431d11cd420536aaa9d93ae510a3151ccc4df1d.zip
frameworks_base-6431d11cd420536aaa9d93ae510a3151ccc4df1d.tar.gz
frameworks_base-6431d11cd420536aaa9d93ae510a3151ccc4df1d.tar.bz2
Add an --abi argument to "pm install"
This allows callers to force an install to a particular ABI. This is intended only for testing (and CTS) and is not meant for usage by the installer package. Change-Id: Icb1528c0cd35b1aa9323386cb35ff4aaba374fcb
Diffstat (limited to 'cmds/pm')
-rw-r--r--cmds/pm/src/com/android/commands/pm/Pm.java30
1 files changed, 27 insertions, 3 deletions
diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java
index d1ded10..75b0a82 100644
--- a/cmds/pm/src/com/android/commands/pm/Pm.java
+++ b/cmds/pm/src/com/android/commands/pm/Pm.java
@@ -38,6 +38,7 @@ import android.content.pm.VerificationParams;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.net.Uri;
+import android.os.Build;
import android.os.IUserManager;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -54,7 +55,6 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.WeakHashMap;
-
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
@@ -801,6 +801,7 @@ public final class Pm {
byte[] tag = null;
String originatingUriString = null;
String referrer = null;
+ String abi = null;
while ((opt=nextOption()) != null) {
if (opt.equals("-l")) {
@@ -871,12 +872,34 @@ public final class Pm {
System.err.println("Error: must supply argument for --referrer");
return;
}
+ } else if (opt.equals("--abi")) {
+ abi = nextOptionData();
+ if (abi == null) {
+ System.err.println("Error: must supply argument for --abi");
+ return;
+ }
} else {
System.err.println("Error: Unknown option: " + opt);
return;
}
}
+ if (abi != null) {
+ final String[] supportedAbis = Build.SUPPORTED_ABIS;
+ boolean matched = false;
+ for (String supportedAbi : supportedAbis) {
+ if (supportedAbi.equals(abi)) {
+ matched = true;
+ break;
+ }
+ }
+
+ if (!matched) {
+ System.err.println("Error: abi " + abi + " not supported on this device.");
+ return;
+ }
+ }
+
final ContainerEncryptionParams encryptionParams;
if (algo != null || iv != null || key != null || macAlgo != null || macKey != null
|| tag != null) {
@@ -954,8 +977,9 @@ public final class Pm {
VerificationParams verificationParams = new VerificationParams(verificationURI,
originatingURI, referrerURI, VerificationParams.NO_UID, null);
- mPm.installPackageWithVerificationAndEncryption(apkURI, obs, installFlags,
- installerPackageName, verificationParams, encryptionParams);
+ mPm.installPackageWithVerificationEncryptionAndAbiOverride(apkURI, obs,
+ installFlags, installerPackageName, verificationParams,
+ encryptionParams, abi);
synchronized (obs) {
while (!obs.finished) {