diff options
author | Jeff Sharkey <jsharkey@android.com> | 2014-07-08 17:10:32 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2014-07-08 17:41:29 -0700 |
commit | 513a074de68a4772a9900e90f38e74ff92c15e7c (patch) | |
tree | 410c98a83b684a34063903496863247c303cb5cb /cmds/pm/src/com/android | |
parent | 8d479b0c2ddb150182bcf510876a240cb869661b (diff) | |
download | frameworks_base-513a074de68a4772a9900e90f38e74ff92c15e7c.zip frameworks_base-513a074de68a4772a9900e90f38e74ff92c15e7c.tar.gz frameworks_base-513a074de68a4772a9900e90f38e74ff92c15e7c.tar.bz2 |
Clean up IPackageManager install surface area.
Also more removal of encryption support.
Change-Id: If525dc5a8422134515f225a8ac4731e968069468
Diffstat (limited to 'cmds/pm/src/com/android')
-rw-r--r-- | cmds/pm/src/com/android/commands/pm/Pm.java | 101 |
1 files changed, 6 insertions, 95 deletions
diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java index f85a7dc..a435fba 100644 --- a/cmds/pm/src/com/android/commands/pm/Pm.java +++ b/cmds/pm/src/com/android/commands/pm/Pm.java @@ -21,7 +21,6 @@ import android.app.ActivityManagerNative; import android.app.IActivityManager; import android.content.ComponentName; import android.content.pm.ApplicationInfo; -import android.content.pm.ContainerEncryptionParams; import android.content.pm.FeatureInfo; import android.content.pm.IPackageDataObserver; import android.content.pm.IPackageDeleteObserver; @@ -48,24 +47,19 @@ import android.os.ServiceManager; import android.os.UserHandle; import android.os.UserManager; +import com.android.internal.content.PackageHelper; +import com.android.internal.util.ArrayUtils; + import java.io.File; import java.io.FileDescriptor; import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import java.security.InvalidAlgorithmParameterException; import java.util.ArrayList; 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; - -import com.android.internal.content.PackageHelper; -import com.android.internal.util.ArrayUtils; - public final class Pm { IPackageManager mPm; IUserManager mUm; @@ -816,13 +810,6 @@ public final class Pm { String opt; - String algo = null; - byte[] iv = null; - byte[] key = null; - - String macAlgo = null; - byte[] macKey = null; - byte[] tag = null; String originatingUriString = null; String referrer = null; String abi = null; @@ -848,42 +835,6 @@ public final class Pm { installFlags |= PackageManager.INSTALL_INTERNAL; } else if (opt.equals("-d")) { installFlags |= PackageManager.INSTALL_ALLOW_DOWNGRADE; - } else if (opt.equals("--algo")) { - algo = nextOptionData(); - if (algo == null) { - System.err.println("Error: must supply argument for --algo"); - return; - } - } else if (opt.equals("--iv")) { - iv = hexToBytes(nextOptionData()); - if (iv == null) { - System.err.println("Error: must supply argument for --iv"); - return; - } - } else if (opt.equals("--key")) { - key = hexToBytes(nextOptionData()); - if (key == null) { - System.err.println("Error: must supply argument for --key"); - return; - } - } else if (opt.equals("--macalgo")) { - macAlgo = nextOptionData(); - if (macAlgo == null) { - System.err.println("Error: must supply argument for --macalgo"); - return; - } - } else if (opt.equals("--mackey")) { - macKey = hexToBytes(nextOptionData()); - if (macKey == null) { - System.err.println("Error: must supply argument for --mackey"); - return; - } - } else if (opt.equals("--tag")) { - tag = hexToBytes(nextOptionData()); - if (tag == null) { - System.err.println("Error: must supply argument for --tag"); - return; - } } else if (opt.equals("--originating-uri")) { originatingUriString = nextOptionData(); if (originatingUriString == null) { @@ -924,43 +875,6 @@ public final class Pm { } } - final ContainerEncryptionParams encryptionParams; - if (algo != null || iv != null || key != null || macAlgo != null || macKey != null - || tag != null) { - if (algo == null || iv == null || key == null) { - System.err.println("Error: all of --algo, --iv, and --key must be specified"); - return; - } - - if (macAlgo != null || macKey != null || tag != null) { - if (macAlgo == null || macKey == null || tag == null) { - System.err.println("Error: all of --macalgo, --mackey, and --tag must " - + "be specified"); - return; - } - } - - try { - final SecretKey encKey = new SecretKeySpec(key, "RAW"); - - final SecretKey macSecretKey; - if (macKey == null || macKey.length == 0) { - macSecretKey = null; - } else { - macSecretKey = new SecretKeySpec(macKey, "RAW"); - } - - encryptionParams = new ContainerEncryptionParams(algo, new IvParameterSpec(iv), - encKey, macAlgo, null, macSecretKey, tag, -1, -1, -1); - } catch (InvalidAlgorithmParameterException e) { - e.printStackTrace(); - return; - } - } else { - encryptionParams = null; - } - - final Uri apkURI; final Uri verificationURI; final Uri originatingURI; final Uri referrerURI; @@ -980,9 +894,7 @@ public final class Pm { // Populate apkURI, must be present final String apkFilePath = nextArg(); System.err.println("\tpkg: " + apkFilePath); - if (apkFilePath != null) { - apkURI = Uri.fromFile(new File(apkFilePath)); - } else { + if (apkFilePath == null) { System.err.println("Error: no package specified"); return; } @@ -1001,9 +913,8 @@ public final class Pm { VerificationParams verificationParams = new VerificationParams(verificationURI, originatingURI, referrerURI, VerificationParams.NO_UID, null); - mPm.installPackageWithVerificationEncryptionAndAbiOverrideEtc(apkURI, null, - obs, installFlags, installerPackageName, verificationParams, - encryptionParams, abi); + mPm.installPackage(apkFilePath, obs, installFlags, installerPackageName, + verificationParams, abi); synchronized (obs) { while (!obs.finished) { |