summaryrefslogtreecommitdiffstats
path: root/cmds/pm/src
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:35:49 +0100
commit116bdbd823b607d860b039ec334a1f985eed7a7f (patch)
tree948d436a288ed6e2edc62988df6394e736e92b82 /cmds/pm/src
parent8627cef5382035dac8f3e68823b239724cc39708 (diff)
downloadframeworks_base-116bdbd823b607d860b039ec334a1f985eed7a7f.zip
frameworks_base-116bdbd823b607d860b039ec334a1f985eed7a7f.tar.gz
frameworks_base-116bdbd823b607d860b039ec334a1f985eed7a7f.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. bug: 14453227 (cherry picked from commit 6431d11cd420536aaa9d93ae510a3151ccc4df1d) Change-Id: I85d4f8785deea02a6a4d3cb0b05e6ef8bf64826b
Diffstat (limited to 'cmds/pm/src')
-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 b7c2c22..47047b8 100644
--- a/cmds/pm/src/com/android/commands/pm/Pm.java
+++ b/cmds/pm/src/com/android/commands/pm/Pm.java
@@ -39,6 +39,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.Bundle;
import android.os.IUserManager;
import android.os.Process;
@@ -57,7 +58,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;
@@ -823,6 +823,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")) {
@@ -893,12 +894,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) {
@@ -976,8 +999,9 @@ public final class Pm {
VerificationParams verificationParams = new VerificationParams(verificationURI,
originatingURI, referrerURI, VerificationParams.NO_UID, null);
- mPm.installPackageWithVerificationAndEncryptionEtc(apkURI, null, obs, installFlags,
- installerPackageName, verificationParams, encryptionParams);
+ mPm.installPackageWithVerificationEncryptionAndAbiOverrideEtc(apkURI, null,
+ obs, installFlags, installerPackageName, verificationParams,
+ encryptionParams, abi);
synchronized (obs) {
while (!obs.finished) {