Merge "No need to pass digest of AndroidManifest.xml around."
diff --git a/api/system-current.txt b/api/system-current.txt
index 6f5db72..c69cc87 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -9550,12 +9550,6 @@
method public abstract void onPackagesUnavailable(java.lang.String[], android.os.UserHandle, boolean);
}
- public class ManifestDigest implements android.os.Parcelable {
- method public int describeContents();
- method public void writeToParcel(android.os.Parcel, int);
- field public static final android.os.Parcelable.Creator<android.content.pm.ManifestDigest> CREATOR;
- }
-
public class PackageInfo implements android.os.Parcelable {
ctor public PackageInfo();
method public int describeContents();
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index 77721e6..a60fbf6 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -42,7 +42,6 @@
import android.content.pm.InstrumentationInfo;
import android.content.pm.IntentFilterVerificationInfo;
import android.content.pm.KeySet;
-import android.content.pm.ManifestDigest;
import android.content.pm.PackageInfo;
import android.content.pm.PackageInstaller;
import android.content.pm.PackageItemInfo;
@@ -1421,7 +1420,7 @@
public void installPackage(Uri packageURI, IPackageInstallObserver observer, int flags,
String installerPackageName) {
final VerificationParams verificationParams = new VerificationParams(null, null,
- null, VerificationParams.NO_UID, null);
+ null, VerificationParams.NO_UID);
installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags,
installerPackageName, verificationParams, null, mContext.getUserId());
}
@@ -1429,9 +1428,9 @@
@Override
public void installPackageWithVerification(Uri packageURI, IPackageInstallObserver observer,
int flags, String installerPackageName, Uri verificationURI,
- ManifestDigest manifestDigest, ContainerEncryptionParams encryptionParams) {
+ ContainerEncryptionParams encryptionParams) {
final VerificationParams verificationParams = new VerificationParams(verificationURI, null,
- null, VerificationParams.NO_UID, manifestDigest);
+ null, VerificationParams.NO_UID);
installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags,
installerPackageName, verificationParams, encryptionParams, mContext.getUserId());
}
@@ -1455,7 +1454,7 @@
public void installPackageAsUser(Uri packageURI, PackageInstallObserver observer, int flags,
String installerPackageName, int userId) {
final VerificationParams verificationParams = new VerificationParams(null, null,
- null, VerificationParams.NO_UID, null);
+ null, VerificationParams.NO_UID);
installCommon(packageURI, observer, flags, installerPackageName, verificationParams, null,
userId);
}
@@ -1463,10 +1462,10 @@
@Override
public void installPackageWithVerification(Uri packageURI,
PackageInstallObserver observer, int flags, String installerPackageName,
- Uri verificationURI, ManifestDigest manifestDigest,
+ Uri verificationURI,
ContainerEncryptionParams encryptionParams) {
final VerificationParams verificationParams = new VerificationParams(verificationURI, null,
- null, VerificationParams.NO_UID, manifestDigest);
+ null, VerificationParams.NO_UID);
installCommon(packageURI, observer, flags, installerPackageName, verificationParams,
encryptionParams, mContext.getUserId());
}
diff --git a/core/java/android/content/pm/ManifestDigest.java b/core/java/android/content/pm/ManifestDigest.java
deleted file mode 100644
index e7dc764..0000000
--- a/core/java/android/content/pm/ManifestDigest.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.content.pm;
-
-import com.android.internal.util.HexDump;
-
-import android.annotation.SystemApi;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.util.Slog;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.DigestInputStream;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.Arrays;
-
-import libcore.io.IoUtils;
-
-/**
- * Represents the manifest digest for a package. This is suitable for comparison
- * of two packages to know whether the manifests are identical.
- *
- * @hide
- */
-@SystemApi
-public class ManifestDigest implements Parcelable {
- private static final String TAG = "ManifestDigest";
-
- /** The digest of the manifest in our preferred order. */
- private final byte[] mDigest;
-
- /** What we print out first when toString() is called. */
- private static final String TO_STRING_PREFIX = "ManifestDigest {mDigest=";
-
- /** Digest algorithm to use. */
- private static final String DIGEST_ALGORITHM = "SHA-256";
-
- ManifestDigest(byte[] digest) {
- mDigest = digest;
- }
-
- private ManifestDigest(Parcel source) {
- mDigest = source.createByteArray();
- }
-
- static ManifestDigest fromInputStream(InputStream fileIs) {
- if (fileIs == null) {
- return null;
- }
-
- final MessageDigest md;
- try {
- md = MessageDigest.getInstance(DIGEST_ALGORITHM);
- } catch (NoSuchAlgorithmException e) {
- throw new RuntimeException(DIGEST_ALGORITHM + " must be available", e);
- }
-
- final DigestInputStream dis = new DigestInputStream(new BufferedInputStream(fileIs), md);
- try {
- byte[] readBuffer = new byte[8192];
- while (dis.read(readBuffer, 0, readBuffer.length) != -1) {
- // not using
- }
- } catch (IOException e) {
- Slog.w(TAG, "Could not read manifest");
- return null;
- } finally {
- IoUtils.closeQuietly(dis);
- }
-
- final byte[] digest = md.digest();
- return new ManifestDigest(digest);
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof ManifestDigest)) {
- return false;
- }
-
- final ManifestDigest other = (ManifestDigest) o;
-
- return this == other || Arrays.equals(mDigest, other.mDigest);
- }
-
- @Override
- public int hashCode() {
- return Arrays.hashCode(mDigest);
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder(TO_STRING_PREFIX.length()
- + (mDigest.length * 3) + 1);
-
- sb.append(TO_STRING_PREFIX);
-
- final int N = mDigest.length;
- for (int i = 0; i < N; i++) {
- final byte b = mDigest[i];
- HexDump.appendByteAsHex(sb, b, false);
- sb.append(',');
- }
- sb.append('}');
-
- return sb.toString();
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeByteArray(mDigest);
- }
-
- public static final Parcelable.Creator<ManifestDigest> CREATOR
- = new Parcelable.Creator<ManifestDigest>() {
- public ManifestDigest createFromParcel(Parcel source) {
- return new ManifestDigest(source);
- }
-
- public ManifestDigest[] newArray(int size) {
- return new ManifestDigest[size];
- }
- };
-
-}
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index e0855de..bccc3d9 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -3899,7 +3899,6 @@
PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0);
if ((flags & GET_SIGNATURES) != 0) {
parser.collectCertificates(pkg, 0);
- parser.collectManifestDigest(pkg);
}
PackageUserState state = new PackageUserState();
return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state);
@@ -3959,14 +3958,12 @@
* @param verificationURI The location of the supplementary verification
* file. This can be a 'file:' or a 'content:' URI. May be
* {@code null}.
- * @param manifestDigest an object that holds the digest of the package
- * which can be used to verify ownership. May be {@code null}.
* @param encryptionParams if the package to be installed is encrypted,
* these parameters describing the encryption and authentication
* used. May be {@code null}.
* @hide
* @deprecated Use {@link #installPackageWithVerification(Uri,
- * PackageInstallObserver, int, String, Uri, ManifestDigest,
+ * PackageInstallObserver, int, String, Uri,
* ContainerEncryptionParams)} instead. This method will
* continue to be supported but the older observer interface
* will not get additional failure details.
@@ -3974,7 +3971,7 @@
// @SystemApi
public abstract void installPackageWithVerification(Uri packageURI,
IPackageInstallObserver observer, int flags, String installerPackageName,
- Uri verificationURI, ManifestDigest manifestDigest,
+ Uri verificationURI,
ContainerEncryptionParams encryptionParams);
/**
@@ -4083,8 +4080,6 @@
* @param verificationURI The location of the supplementary verification
* file. This can be a 'file:' or a 'content:' URI. May be
* {@code null}.
- * @param manifestDigest an object that holds the digest of the package
- * which can be used to verify ownership. May be {@code null}.
* @param encryptionParams if the package to be installed is encrypted,
* these parameters describing the encryption and authentication
* used. May be {@code null}.
@@ -4092,7 +4087,7 @@
*/
public abstract void installPackageWithVerification(Uri packageURI,
PackageInstallObserver observer, int flags, String installerPackageName,
- Uri verificationURI, ManifestDigest manifestDigest,
+ Uri verificationURI,
ContainerEncryptionParams encryptionParams);
/**
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index a145231..236cf64a 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -1032,31 +1032,6 @@
}
/**
- * Gathers the {@link ManifestDigest} for {@code pkg} if it exists in the
- * APK. If it successfully scanned the package and found the
- * {@code AndroidManifest.xml}, {@code true} is returned.
- */
- public void collectManifestDigest(Package pkg) throws PackageParserException {
- pkg.manifestDigest = null;
-
- // TODO: extend to gather digest for split APKs
- try {
- final StrictJarFile jarFile = new StrictJarFile(pkg.baseCodePath);
- try {
- final ZipEntry je = jarFile.findEntry(ANDROID_MANIFEST_FILENAME);
- if (je != null) {
- pkg.manifestDigest = ManifestDigest.fromInputStream(jarFile.getInputStream(je));
- }
- } finally {
- jarFile.close();
- }
- } catch (IOException | RuntimeException e) {
- throw new PackageParserException(INSTALL_PARSE_FAILED_MANIFEST_MALFORMED,
- "Failed to collect manifest digest");
- }
- }
-
- /**
* Collect certificates from all the APKs described in the given package,
* populating {@link Package#mSignatures}. Also asserts that all APK
* contents are signed correctly and consistently.
@@ -4499,12 +4474,6 @@
/* The required account type without which this application will not function */
public String mRequiredAccountType;
- /**
- * Digest suitable for comparing whether this package's manifest is the
- * same as another.
- */
- public ManifestDigest manifestDigest;
-
public String mOverlayTarget;
public int mOverlayPriority;
public boolean mTrustedOverlay;
diff --git a/core/java/android/content/pm/VerificationParams.java b/core/java/android/content/pm/VerificationParams.java
index e5119b6..f90d295 100644
--- a/core/java/android/content/pm/VerificationParams.java
+++ b/core/java/android/content/pm/VerificationParams.java
@@ -16,7 +16,6 @@
package android.content.pm;
-import android.content.pm.ManifestDigest;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
@@ -51,12 +50,6 @@
private int mInstallerUid;
/**
- * An object that holds the digest of the package which can be used to
- * verify ownership.
- */
- private final ManifestDigest mManifestDigest;
-
- /**
* Creates verification specifications for installing with application verification.
*
* @param verificationURI The location of the supplementary verification
@@ -67,16 +60,13 @@
* May be {@code null}.
* @param originatingUid UID of the application that the install request originated
* from, or NO_UID if not present
- * @param manifestDigest an object that holds the digest of the package
- * which can be used to verify ownership. May be {@code null}.
*/
public VerificationParams(Uri verificationURI, Uri originatingURI, Uri referrer,
- int originatingUid, ManifestDigest manifestDigest) {
+ int originatingUid) {
mVerificationURI = verificationURI;
mOriginatingURI = originatingURI;
mReferrer = referrer;
mOriginatingUid = originatingUid;
- mManifestDigest = manifestDigest;
mInstallerUid = NO_UID;
}
@@ -97,10 +87,6 @@
return mOriginatingUid;
}
- public ManifestDigest getManifestDigest() {
- return mManifestDigest;
- }
-
/** @return NO_UID when not set */
public int getInstallerUid() {
return mInstallerUid;
@@ -155,14 +141,6 @@
return false;
}
- if (mManifestDigest == null) {
- if (other.mManifestDigest != null) {
- return false;
- }
- } else if (!mManifestDigest.equals(other.mManifestDigest)) {
- return false;
- }
-
if (mInstallerUid != other.mInstallerUid) {
return false;
}
@@ -178,8 +156,7 @@
hash += 7 * (mOriginatingURI == null ? 1 : mOriginatingURI.hashCode());
hash += 11 * (mReferrer == null ? 1 : mReferrer.hashCode());
hash += 13 * mOriginatingUid;
- hash += 17 * (mManifestDigest == null ? 1 : mManifestDigest.hashCode());
- hash += 19 * mInstallerUid;
+ hash += 17 * mInstallerUid;
return hash;
}
@@ -196,8 +173,6 @@
sb.append(mReferrer.toString());
sb.append(",mOriginatingUid=");
sb.append(mOriginatingUid);
- sb.append(",mManifestDigest=");
- sb.append(mManifestDigest.toString());
sb.append(",mInstallerUid=");
sb.append(mInstallerUid);
sb.append('}');
@@ -211,7 +186,6 @@
dest.writeParcelable(mOriginatingURI, 0);
dest.writeParcelable(mReferrer, 0);
dest.writeInt(mOriginatingUid);
- dest.writeParcelable(mManifestDigest, 0);
dest.writeInt(mInstallerUid);
}
@@ -221,7 +195,6 @@
mOriginatingURI = source.readParcelable(Uri.class.getClassLoader());
mReferrer = source.readParcelable(Uri.class.getClassLoader());
mOriginatingUid = source.readInt();
- mManifestDigest = source.readParcelable(ManifestDigest.class.getClassLoader());
mInstallerUid = source.readInt();
}
diff --git a/core/tests/coretests/src/android/content/pm/ManifestDigestTest.java b/core/tests/coretests/src/android/content/pm/ManifestDigestTest.java
deleted file mode 100644
index 37495e1..0000000
--- a/core/tests/coretests/src/android/content/pm/ManifestDigestTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.content.pm;
-
-import android.os.Parcel;
-import android.test.AndroidTestCase;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.MessageDigest;
-
-public class ManifestDigestTest extends AndroidTestCase {
- private static final byte[] MESSAGE_1 = {
- (byte) 0x00, (byte) 0xAA, (byte) 0x55, (byte) 0xFF
- };
-
- public void testManifestDigest_FromInputStream_Null() {
- assertNull("Attributes were null, so ManifestDigest.fromAttributes should return null",
- ManifestDigest.fromInputStream(null));
- }
-
- public void testManifestDigest_FromInputStream_ThrowsIoException() {
- InputStream is = new InputStream() {
- @Override
- public int read() throws IOException {
- throw new IOException();
- }
- };
-
- assertNull("InputStream threw exception, so ManifestDigest should be null",
- ManifestDigest.fromInputStream(is));
- }
-
- public void testManifestDigest_Equals() throws Exception {
- InputStream is = new ByteArrayInputStream(MESSAGE_1);
-
- ManifestDigest expected =
- new ManifestDigest(MessageDigest.getInstance("SHA-256").digest(MESSAGE_1));
-
- ManifestDigest actual = ManifestDigest.fromInputStream(is);
- assertEquals(expected, actual);
-
- ManifestDigest unexpected = new ManifestDigest(new byte[0]);
- assertFalse(unexpected.equals(actual));
- }
-
- public void testManifestDigest_Parcel() throws Exception {
- InputStream is = new ByteArrayInputStream(MESSAGE_1);
-
- ManifestDigest digest = ManifestDigest.fromInputStream(is);
-
- Parcel p = Parcel.obtain();
- digest.writeToParcel(p, 0);
- p.setDataPosition(0);
-
- ManifestDigest fromParcel = ManifestDigest.CREATOR.createFromParcel(p);
-
- assertEquals("ManifestDigest going through parceling should be the same as before: "
- + digest.toString() + " and " + fromParcel.toString(), digest,
- fromParcel);
- }
-}
diff --git a/core/tests/coretests/src/android/content/pm/VerificationParamsTest.java b/core/tests/coretests/src/android/content/pm/VerificationParamsTest.java
index 9b216cb..d963812 100644
--- a/core/tests/coretests/src/android/content/pm/VerificationParamsTest.java
+++ b/core/tests/coretests/src/android/content/pm/VerificationParamsTest.java
@@ -16,7 +16,6 @@
package android.content.pm;
-import android.content.pm.ManifestDigest;
import android.content.pm.VerificationParams;
import android.net.Uri;
import android.os.Parcel;
@@ -33,7 +32,6 @@
private final static String VERIFICATION_URI_STRING = "http://verification.uri/path";
private final static String ORIGINATING_URI_STRING = "http://originating.uri/path";
private final static String REFERRER_STRING = "http://referrer.uri/path";
- private final static byte[] DIGEST_BYTES = "fake digest".getBytes();
private final static int INSTALLER_UID = 42;
private final static Uri VERIFICATION_URI = Uri.parse(VERIFICATION_URI_STRING);
@@ -42,11 +40,9 @@
private final static int ORIGINATING_UID = 10042;
- private final static ManifestDigest MANIFEST_DIGEST = new ManifestDigest(DIGEST_BYTES);
-
public void testParcel() throws Exception {
VerificationParams expected = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
+ REFERRER, ORIGINATING_UID);
Parcel parcel = Parcel.obtain();
expected.writeToParcel(parcel, 0);
@@ -61,85 +57,70 @@
assertEquals(REFERRER, actual.getReferrer());
assertEquals(ORIGINATING_UID, actual.getOriginatingUid());
-
- assertEquals(MANIFEST_DIGEST, actual.getManifestDigest());
}
public void testEquals_Success() throws Exception {
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
+ REFERRER, ORIGINATING_UID);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID, new ManifestDigest(DIGEST_BYTES));
+ Uri.parse(REFERRER_STRING), ORIGINATING_UID);
assertEquals(params1, params2);
}
public void testEquals_VerificationUri_Failure() throws Exception {
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
+ REFERRER, ORIGINATING_UID);
VerificationParams params2 = new VerificationParams(
Uri.parse("http://a.different.uri/"), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID, new ManifestDigest(DIGEST_BYTES));
+ Uri.parse(REFERRER_STRING), ORIGINATING_UID);
assertFalse(params1.equals(params2));
}
public void testEquals_OriginatingUri_Failure() throws Exception {
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
+ REFERRER, ORIGINATING_UID);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse("http://a.different.uri/"),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID, new ManifestDigest(DIGEST_BYTES));
+ Uri.parse(REFERRER_STRING), ORIGINATING_UID);
assertFalse(params1.equals(params2));
}
public void testEquals_Referrer_Failure() throws Exception {
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
+ REFERRER, ORIGINATING_UID);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse("http://a.different.uri/"), ORIGINATING_UID,
- new ManifestDigest(DIGEST_BYTES));
+ Uri.parse("http://a.different.uri/"), ORIGINATING_UID);
assertFalse(params1.equals(params2));
}
public void testEquals_Originating_Uid_Failure() throws Exception {
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
+ REFERRER, ORIGINATING_UID);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), 12345, new ManifestDigest(DIGEST_BYTES));
-
- assertFalse(params1.equals(params2));
- }
-
- public void testEquals_ManifestDigest_Failure() throws Exception {
- VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
-
- VerificationParams params2 = new VerificationParams(
- Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID,
- new ManifestDigest("a different digest".getBytes()));
+ Uri.parse(REFERRER_STRING), 12345);
assertFalse(params1.equals(params2));
}
public void testEquals_InstallerUid_Failure() throws Exception {
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
+ REFERRER, ORIGINATING_UID);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID, new ManifestDigest(DIGEST_BYTES));
+ Uri.parse(REFERRER_STRING), ORIGINATING_UID);
params2.setInstallerUid(INSTALLER_UID);
assertFalse(params1.equals(params2));
@@ -147,78 +128,65 @@
public void testHashCode_Success() throws Exception {
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
+ REFERRER, ORIGINATING_UID);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID, new ManifestDigest(DIGEST_BYTES));
+ Uri.parse(REFERRER_STRING), ORIGINATING_UID);
assertEquals(params1.hashCode(), params2.hashCode());
}
public void testHashCode_VerificationUri_Failure() throws Exception {
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
+ REFERRER, ORIGINATING_UID);
VerificationParams params2 = new VerificationParams(null, Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID, new ManifestDigest(DIGEST_BYTES));
+ Uri.parse(REFERRER_STRING), ORIGINATING_UID);
assertFalse(params1.hashCode() == params2.hashCode());
}
public void testHashCode_OriginatingUri_Failure() throws Exception {
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
+ REFERRER, ORIGINATING_UID);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse("http://a.different.uri/"),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID, new ManifestDigest(DIGEST_BYTES));
+ Uri.parse(REFERRER_STRING), ORIGINATING_UID);
assertFalse(params1.hashCode() == params2.hashCode());
}
public void testHashCode_Referrer_Failure() throws Exception {
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
+ REFERRER, ORIGINATING_UID);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING), null,
- ORIGINATING_UID, new ManifestDigest(DIGEST_BYTES));
+ ORIGINATING_UID);
assertFalse(params1.hashCode() == params2.hashCode());
}
public void testHashCode_Originating_Uid_Failure() throws Exception {
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
+ REFERRER, ORIGINATING_UID);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), 12345, new ManifestDigest(DIGEST_BYTES));
-
- assertFalse(params1.hashCode() == params2.hashCode());
- }
-
- public void testHashCode_ManifestDigest_Failure() throws Exception {
- VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
-
- VerificationParams params2 = new VerificationParams(
- Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID,
- new ManifestDigest("a different digest".getBytes()));
+ Uri.parse(REFERRER_STRING), 12345);
assertFalse(params1.hashCode() == params2.hashCode());
}
public void testHashCode_InstallerUid_Failure() throws Exception {
VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI,
- REFERRER, ORIGINATING_UID, MANIFEST_DIGEST);
+ REFERRER, ORIGINATING_UID);
VerificationParams params2 = new VerificationParams(
Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING),
- Uri.parse(REFERRER_STRING), ORIGINATING_UID,
- new ManifestDigest("a different digest".getBytes()));
+ Uri.parse(REFERRER_STRING), ORIGINATING_UID);
params2.setInstallerUid(INSTALLER_UID);
assertFalse(params1.hashCode() == params2.hashCode());
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index a07476c..7e186a0 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -123,7 +123,6 @@
import android.content.pm.InstrumentationInfo;
import android.content.pm.IntentFilterVerificationInfo;
import android.content.pm.KeySet;
-import android.content.pm.ManifestDigest;
import android.content.pm.PackageCleanItem;
import android.content.pm.PackageInfo;
import android.content.pm.PackageInfoLite;
@@ -6249,7 +6248,6 @@
try {
pp.collectCertificates(pkg, parseFlags);
- pp.collectManifestDigest(pkg);
} catch (PackageParserException e) {
throw PackageManagerException.from(e);
}
@@ -10081,7 +10079,7 @@
}
final VerificationParams verifParams = new VerificationParams(
null, sessionParams.originatingUri, sessionParams.referrerUri,
- sessionParams.originatingUid, null);
+ sessionParams.originatingUid);
verifParams.setInstallerUid(installerUid);
final OriginInfo origin;
@@ -11063,13 +11061,6 @@
+ " file=" + origin.file + " cid=" + origin.cid + "}";
}
- public ManifestDigest getManifestDigest() {
- if (verificationParams == null) {
- return null;
- }
- return verificationParams.getManifestDigest();
- }
-
private int installLocationPolicy(PackageInfoLite pkgLite) {
String packageName = pkgLite.packageName;
int installLocation = pkgLite.installLocation;
@@ -11488,7 +11479,6 @@
final int installFlags;
final String installerPackageName;
final String volumeUuid;
- final ManifestDigest manifestDigest;
final UserHandle user;
final String abiOverride;
final String[] installGrantPermissions;
@@ -11503,7 +11493,7 @@
InstallArgs(OriginInfo origin, MoveInfo move, IPackageInstallObserver2 observer,
int installFlags, String installerPackageName, String volumeUuid,
- ManifestDigest manifestDigest, UserHandle user, String[] instructionSets,
+ UserHandle user, String[] instructionSets,
String abiOverride, String[] installGrantPermissions,
String traceMethod, int traceCookie) {
this.origin = origin;
@@ -11512,7 +11502,6 @@
this.observer = observer;
this.installerPackageName = installerPackageName;
this.volumeUuid = volumeUuid;
- this.manifestDigest = manifestDigest;
this.user = user;
this.instructionSets = instructionSets;
this.abiOverride = abiOverride;
@@ -11614,7 +11603,7 @@
/** New install */
FileInstallArgs(InstallParams params) {
super(params.origin, params.move, params.observer, params.installFlags,
- params.installerPackageName, params.volumeUuid, params.getManifestDigest(),
+ params.installerPackageName, params.volumeUuid,
params.getUser(), null /* instruction sets */, params.packageAbiOverride,
params.grantedRuntimePermissions,
params.traceMethod, params.traceCookie);
@@ -11625,7 +11614,7 @@
/** Existing install */
FileInstallArgs(String codePath, String resourcePath, String[] instructionSets) {
- super(OriginInfo.fromNothing(), null, null, 0, null, null, null, null, instructionSets,
+ super(OriginInfo.fromNothing(), null, null, 0, null, null, null, instructionSets,
null, null, null, 0);
this.codeFile = (codePath != null) ? new File(codePath) : null;
this.resourceFile = (resourcePath != null) ? new File(resourcePath) : null;
@@ -11852,7 +11841,7 @@
/** New install */
AsecInstallArgs(InstallParams params) {
super(params.origin, params.move, params.observer, params.installFlags,
- params.installerPackageName, params.volumeUuid, params.getManifestDigest(),
+ params.installerPackageName, params.volumeUuid,
params.getUser(), null /* instruction sets */, params.packageAbiOverride,
params.grantedRuntimePermissions,
params.traceMethod, params.traceCookie);
@@ -11862,7 +11851,7 @@
AsecInstallArgs(String fullCodePath, String[] instructionSets,
boolean isExternal, boolean isForwardLocked) {
super(OriginInfo.fromNothing(), null, null, (isExternal ? INSTALL_EXTERNAL : 0)
- | (isForwardLocked ? INSTALL_FORWARD_LOCK : 0), null, null, null, null,
+ | (isForwardLocked ? INSTALL_FORWARD_LOCK : 0), null, null, null,
instructionSets, null, null, null, 0);
// Hackily pretend we're still looking at a full code path
if (!fullCodePath.endsWith(RES_FILE_NAME)) {
@@ -11879,7 +11868,7 @@
AsecInstallArgs(String cid, String[] instructionSets, boolean isForwardLocked) {
super(OriginInfo.fromNothing(), null, null, (isAsecExternal(cid) ? INSTALL_EXTERNAL : 0)
- | (isForwardLocked ? INSTALL_FORWARD_LOCK : 0), null, null, null, null,
+ | (isForwardLocked ? INSTALL_FORWARD_LOCK : 0), null, null, null,
instructionSets, null, null, null, 0);
this.cid = cid;
setMountPath(PackageHelper.getSdDir(cid));
@@ -12146,7 +12135,7 @@
/** New install */
MoveInstallArgs(InstallParams params) {
super(params.origin, params.move, params.observer, params.installFlags,
- params.installerPackageName, params.volumeUuid, params.getManifestDigest(),
+ params.installerPackageName, params.volumeUuid,
params.getUser(), null /* instruction sets */, params.packageAbiOverride,
params.grantedRuntimePermissions,
params.traceMethod, params.traceCookie);
@@ -12920,35 +12909,6 @@
Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
}
- /* If the installer passed in a manifest digest, compare it now. */
- if (args.manifestDigest != null) {
- Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "collectManifestDigest");
- try {
- pp.collectManifestDigest(pkg);
- } catch (PackageParserException e) {
- res.setError("Failed collect during installPackageLI", e);
- return;
- } finally {
- Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
- }
-
- if (DEBUG_INSTALL) {
- final String parsedManifest = pkg.manifestDigest == null ? "null"
- : pkg.manifestDigest.toString();
- Slog.d(TAG, "Comparing manifests: " + args.manifestDigest.toString() + " vs. "
- + parsedManifest);
- }
-
- if (!args.manifestDigest.equals(pkg.manifestDigest)) {
- res.setError(INSTALL_FAILED_PACKAGE_CHANGED, "Manifest digest changed");
- return;
- }
- } else if (DEBUG_INSTALL) {
- final String parsedManifest = pkg.manifestDigest == null
- ? "null" : pkg.manifestDigest.toString();
- Slog.d(TAG, "manifestDigest was not present, but parser got: " + parsedManifest);
- }
-
// Get rid of all references to package scan path via parser.
pp = null;
String oldCodePath = null;
diff --git a/test-runner/src/android/test/mock/MockPackageManager.java b/test-runner/src/android/test/mock/MockPackageManager.java
index 2813df5..2cef1b3 100644
--- a/test-runner/src/android/test/mock/MockPackageManager.java
+++ b/test-runner/src/android/test/mock/MockPackageManager.java
@@ -34,7 +34,6 @@
import android.content.pm.InstrumentationInfo;
import android.content.pm.IntentFilterVerificationInfo;
import android.content.pm.KeySet;
-import android.content.pm.ManifestDigest;
import android.content.pm.PackageInfo;
import android.content.pm.PackageInstaller;
import android.content.pm.PackageItemInfo;
@@ -820,7 +819,7 @@
@Override
public void installPackageWithVerification(Uri packageURI, IPackageInstallObserver observer,
int flags, String installerPackageName, Uri verificationURI,
- ManifestDigest manifestDigest, ContainerEncryptionParams encryptionParams) {
+ ContainerEncryptionParams encryptionParams) {
throw new UnsupportedOperationException();
}
@@ -957,7 +956,7 @@
@Override
public void installPackageWithVerification(Uri packageURI,
PackageInstallObserver observer, int flags, String installerPackageName,
- Uri verificationURI, ManifestDigest manifestDigest,
+ Uri verificationURI,
ContainerEncryptionParams encryptionParams) {
throw new UnsupportedOperationException();
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePackageManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePackageManager.java
index a2fad13..3f9574f 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePackageManager.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePackageManager.java
@@ -34,7 +34,6 @@
import android.content.pm.InstrumentationInfo;
import android.content.pm.IntentFilterVerificationInfo;
import android.content.pm.KeySet;
-import android.content.pm.ManifestDigest;
import android.content.pm.PackageInfo;
import android.content.pm.PackageInstaller;
import android.content.pm.PackageItemInfo;
@@ -522,7 +521,7 @@
@Override
public void installPackageWithVerification(Uri packageURI, IPackageInstallObserver observer,
int flags, String installerPackageName, Uri verificationURI,
- ManifestDigest manifestDigest, ContainerEncryptionParams encryptionParams) {
+ ContainerEncryptionParams encryptionParams) {
}
@Override
@@ -544,7 +543,7 @@
@Override
public void installPackageWithVerification(Uri packageURI, PackageInstallObserver observer,
int flags, String installerPackageName, Uri verificationURI,
- ManifestDigest manifestDigest, ContainerEncryptionParams encryptionParams) {
+ ContainerEncryptionParams encryptionParams) {
}
@Override