summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ApplicationPackageManager.java11
-rw-r--r--core/java/android/content/pm/ApkChecksum.aidl (renamed from core/java/android/content/pm/FileChecksum.aidl)2
-rw-r--r--core/java/android/content/pm/ApkChecksum.java (renamed from core/java/android/content/pm/FileChecksum.java)123
-rw-r--r--core/java/android/content/pm/Checksum.aidl20
-rw-r--r--core/java/android/content/pm/Checksum.java228
-rw-r--r--core/java/android/content/pm/IPackageInstallerSession.aidl3
-rw-r--r--core/java/android/content/pm/PackageInstaller.java25
-rw-r--r--core/java/android/content/pm/PackageManager.java72
8 files changed, 347 insertions, 137 deletions
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index 2780036d8102..066a00732965 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -16,6 +16,14 @@
package android.app;
+import static android.content.pm.Checksum.PARTIAL_MERKLE_ROOT_1M_SHA256;
+import static android.content.pm.Checksum.PARTIAL_MERKLE_ROOT_1M_SHA512;
+import static android.content.pm.Checksum.WHOLE_MD5;
+import static android.content.pm.Checksum.WHOLE_MERKLE_ROOT_4K_SHA256;
+import static android.content.pm.Checksum.WHOLE_SHA1;
+import static android.content.pm.Checksum.WHOLE_SHA256;
+import static android.content.pm.Checksum.WHOLE_SHA512;
+
import android.annotation.DrawableRes;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -32,6 +40,7 @@ import android.content.IntentSender;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.ChangedPackages;
+import android.content.pm.Checksum;
import android.content.pm.ComponentInfo;
import android.content.pm.FeatureInfo;
import android.content.pm.IPackageDataObserver;
@@ -973,7 +982,7 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public void getChecksums(@NonNull String packageName, boolean includeSplits,
- @FileChecksumKind int required, @Nullable List<Certificate> trustedInstallers,
+ @Checksum.Kind int required, @Nullable List<Certificate> trustedInstallers,
@NonNull IntentSender statusReceiver)
throws CertificateEncodingException, IOException, NameNotFoundException {
Objects.requireNonNull(packageName);
diff --git a/core/java/android/content/pm/FileChecksum.aidl b/core/java/android/content/pm/ApkChecksum.aidl
index 109f211033c1..46781fe26677 100644
--- a/core/java/android/content/pm/FileChecksum.aidl
+++ b/core/java/android/content/pm/ApkChecksum.aidl
@@ -16,5 +16,5 @@
package android.content.pm;
-parcelable FileChecksum;
+parcelable ApkChecksum;
diff --git a/core/java/android/content/pm/FileChecksum.java b/core/java/android/content/pm/ApkChecksum.java
index 55430c2b877b..e087c44d1ed1 100644
--- a/core/java/android/content/pm/FileChecksum.java
+++ b/core/java/android/content/pm/ApkChecksum.java
@@ -34,51 +34,71 @@ import java.security.cert.X509Certificate;
import java.util.List;
/**
- * A typed checksum.
+ * A typed checksum of an APK.
*
* @see PackageManager#getChecksums(String, boolean, int, List, IntentSender)
*/
@DataClass(genHiddenConstructor = true)
-public final class FileChecksum implements Parcelable {
+@DataClass.Suppress({"getChecksum"})
+public final class ApkChecksum implements Parcelable {
/**
* Checksum for which split. Null indicates base.apk.
*/
private final @Nullable String mSplitName;
/**
- * Checksum kind.
+ * Checksum.
*/
- private final @PackageManager.FileChecksumKind int mKind;
- /**
- * Checksum value.
- */
- private final @NonNull byte[] mValue;
+ private final @NonNull Checksum mChecksum;
/**
* For Installer-provided checksums, certificate of the Installer/AppStore.
*/
private final @Nullable byte[] mSourceCertificate;
/**
- * Constructor, internal use only
+ * Constructor, internal use only.
*
* @hide
*/
- public FileChecksum(@Nullable String splitName, @PackageManager.FileChecksumKind int kind,
+ public ApkChecksum(@Nullable String splitName, @Checksum.Kind int kind,
@NonNull byte[] value) {
- this(splitName, kind, value, (byte[]) null);
+ this(splitName, new Checksum(kind, value), (byte[]) null);
}
/**
- * Constructor, internal use only
+ * Constructor, internal use only.
*
* @hide
*/
- public FileChecksum(@Nullable String splitName, @PackageManager.FileChecksumKind int kind,
+ public ApkChecksum(@Nullable String splitName, @Checksum.Kind int kind,
@NonNull byte[] value, @Nullable Certificate sourceCertificate)
throws CertificateEncodingException {
- this(splitName, kind, value,
+ this(splitName, new Checksum(kind, value),
(sourceCertificate != null) ? sourceCertificate.getEncoded() : null);
}
+
+ /**
+ * Checksum kind.
+ */
+ public @Checksum.Kind int getKind() {
+ return mChecksum.getKind();
+ }
+
+ /**
+ * Checksum value.
+ */
+ public @NonNull byte[] getValue() {
+ return mChecksum.getValue();
+ }
+
+ /**
+ * Returns raw bytes representing encoded certificate of the source of this checksum.
+ * @hide
+ */
+ public @Nullable byte[] getSourceCertificateBytes() {
+ return mSourceCertificate;
+ }
+
/**
* Certificate of the source of this checksum.
* @throws CertificateException in case when certificate can't be re-created from serialized
@@ -102,7 +122,7 @@ public final class FileChecksum implements Parcelable {
// CHECKSTYLE:OFF Generated code
//
// To regenerate run:
- // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/content/pm/FileChecksum.java
+ // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/content/pm/ApkChecksum.java
//
// To exclude the generated code from IntelliJ auto-formatting enable (one-time):
// Settings > Editor > Code Style > Formatter Control
@@ -110,31 +130,25 @@ public final class FileChecksum implements Parcelable {
/**
- * Creates a new FileChecksum.
+ * Creates a new ApkChecksum.
*
* @param splitName
* Checksum for which split. Null indicates base.apk.
- * @param kind
- * Checksum kind.
- * @param value
- * Checksum value.
+ * @param checksum
+ * Checksum.
* @param sourceCertificate
* For Installer-provided checksums, certificate of the Installer/AppStore.
* @hide
*/
@DataClass.Generated.Member
- public FileChecksum(
+ public ApkChecksum(
@Nullable String splitName,
- @PackageManager.FileChecksumKind int kind,
- @NonNull byte[] value,
+ @NonNull Checksum checksum,
@Nullable byte[] sourceCertificate) {
this.mSplitName = splitName;
- this.mKind = kind;
+ this.mChecksum = checksum;
com.android.internal.util.AnnotationValidations.validate(
- PackageManager.FileChecksumKind.class, null, mKind);
- this.mValue = value;
- com.android.internal.util.AnnotationValidations.validate(
- NonNull.class, null, mValue);
+ NonNull.class, null, mChecksum);
this.mSourceCertificate = sourceCertificate;
// onConstructed(); // You can define this method to get a callback
@@ -148,22 +162,6 @@ public final class FileChecksum implements Parcelable {
return mSplitName;
}
- /**
- * Checksum kind.
- */
- @DataClass.Generated.Member
- public @PackageManager.FileChecksumKind int getKind() {
- return mKind;
- }
-
- /**
- * Checksum value.
- */
- @DataClass.Generated.Member
- public @NonNull byte[] getValue() {
- return mValue;
- }
-
@Override
@DataClass.Generated.Member
public void writeToParcel(@NonNull Parcel dest, int flags) {
@@ -172,11 +170,10 @@ public final class FileChecksum implements Parcelable {
byte flg = 0;
if (mSplitName != null) flg |= 0x1;
- if (mSourceCertificate != null) flg |= 0x8;
+ if (mSourceCertificate != null) flg |= 0x4;
dest.writeByte(flg);
if (mSplitName != null) dest.writeString(mSplitName);
- dest.writeInt(mKind);
- dest.writeByteArray(mValue);
+ dest.writeTypedObject(mChecksum, flags);
if (mSourceCertificate != null) dest.writeByteArray(mSourceCertificate);
}
@@ -187,47 +184,43 @@ public final class FileChecksum implements Parcelable {
/** @hide */
@SuppressWarnings({"unchecked", "RedundantCast"})
@DataClass.Generated.Member
- /* package-private */ FileChecksum(@NonNull Parcel in) {
+ /* package-private */ ApkChecksum(@NonNull Parcel in) {
// You can override field unparcelling by defining methods like:
// static FieldType unparcelFieldName(Parcel in) { ... }
byte flg = in.readByte();
String splitName = (flg & 0x1) == 0 ? null : in.readString();
- int kind = in.readInt();
- byte[] value = in.createByteArray();
- byte[] sourceCertificate = (flg & 0x8) == 0 ? null : in.createByteArray();
+ Checksum checksum = (Checksum) in.readTypedObject(Checksum.CREATOR);
+ byte[] sourceCertificate = (flg & 0x4) == 0 ? null : in.createByteArray();
this.mSplitName = splitName;
- this.mKind = kind;
- com.android.internal.util.AnnotationValidations.validate(
- PackageManager.FileChecksumKind.class, null, mKind);
- this.mValue = value;
+ this.mChecksum = checksum;
com.android.internal.util.AnnotationValidations.validate(
- NonNull.class, null, mValue);
+ NonNull.class, null, mChecksum);
this.mSourceCertificate = sourceCertificate;
// onConstructed(); // You can define this method to get a callback
}
@DataClass.Generated.Member
- public static final @NonNull Parcelable.Creator<FileChecksum> CREATOR
- = new Parcelable.Creator<FileChecksum>() {
+ public static final @NonNull Parcelable.Creator<ApkChecksum> CREATOR
+ = new Parcelable.Creator<ApkChecksum>() {
@Override
- public FileChecksum[] newArray(int size) {
- return new FileChecksum[size];
+ public ApkChecksum[] newArray(int size) {
+ return new ApkChecksum[size];
}
@Override
- public FileChecksum createFromParcel(@NonNull Parcel in) {
- return new FileChecksum(in);
+ public ApkChecksum createFromParcel(@NonNull Parcel in) {
+ return new ApkChecksum(in);
}
};
@DataClass.Generated(
- time = 1598322801861L,
+ time = 1599845645160L,
codegenVersion = "1.0.15",
- sourceFile = "frameworks/base/core/java/android/content/pm/FileChecksum.java",
- inputSignatures = "private final @android.annotation.Nullable java.lang.String mSplitName\nprivate final @android.content.pm.PackageManager.FileChecksumKind int mKind\nprivate final @android.annotation.NonNull byte[] mValue\nprivate final @android.annotation.Nullable byte[] mSourceCertificate\npublic @android.annotation.Nullable java.security.cert.Certificate getSourceCertificate()\nclass FileChecksum extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genHiddenConstructor=true)")
+ sourceFile = "frameworks/base/core/java/android/content/pm/ApkChecksum.java",
+ inputSignatures = "private final @android.annotation.Nullable java.lang.String mSplitName\nprivate final @android.annotation.NonNull android.content.pm.Checksum mChecksum\nprivate final @android.annotation.Nullable byte[] mSourceCertificate\npublic @android.content.pm.Checksum.Kind int getKind()\npublic @android.annotation.NonNull byte[] getValue()\npublic @android.annotation.Nullable byte[] getSourceCertificateBytes()\npublic @android.annotation.Nullable java.security.cert.Certificate getSourceCertificate()\nclass ApkChecksum extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genHiddenConstructor=true)")
@Deprecated
private void __metadata() {}
diff --git a/core/java/android/content/pm/Checksum.aidl b/core/java/android/content/pm/Checksum.aidl
new file mode 100644
index 000000000000..f0ca206fad58
--- /dev/null
+++ b/core/java/android/content/pm/Checksum.aidl
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2020 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;
+
+parcelable Checksum;
+
diff --git a/core/java/android/content/pm/Checksum.java b/core/java/android/content/pm/Checksum.java
new file mode 100644
index 000000000000..123aaddda7ce
--- /dev/null
+++ b/core/java/android/content/pm/Checksum.java
@@ -0,0 +1,228 @@
+/*
+ * Copyright (C) 2020 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.annotation.IntDef;
+import android.annotation.NonNull;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.android.internal.util.DataClass;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.List;
+
+/**
+ * A typed checksum.
+ *
+ * @see PackageInstaller.Session#addChecksums(String, List)
+ */
+@DataClass(genHiddenConstructor = true, genConstDefs = false)
+public final class Checksum implements Parcelable {
+ /**
+ * Root SHA256 hash of a 4K Merkle tree computed over all file bytes.
+ * <a href="https://source.android.com/security/apksigning/v4">See APK Signature Scheme V4</a>.
+ * <a href="https://git.kernel.org/pub/scm/fs/fscrypt/fscrypt.git/tree/Documentation/filesystems/fsverity.rst">See fs-verity</a>.
+ *
+ * @see PackageManager#getChecksums
+ */
+ public static final int WHOLE_MERKLE_ROOT_4K_SHA256 = 0x00000001;
+
+ /**
+ * MD5 hash computed over all file bytes.
+ *
+ * @see PackageManager#getChecksums
+ */
+ public static final int WHOLE_MD5 = 0x00000002;
+
+ /**
+ * SHA1 hash computed over all file bytes.
+ *
+ * @see PackageManager#getChecksums
+ */
+ public static final int WHOLE_SHA1 = 0x00000004;
+
+ /**
+ * SHA256 hash computed over all file bytes.
+ *
+ * @see PackageManager#getChecksums
+ */
+ public static final int WHOLE_SHA256 = 0x00000008;
+
+ /**
+ * SHA512 hash computed over all file bytes.
+ *
+ * @see PackageManager#getChecksums
+ */
+ public static final int WHOLE_SHA512 = 0x00000010;
+
+ /**
+ * Root SHA256 hash of a 1M Merkle tree computed over protected content.
+ * Excludes signing block.
+ * <a href="https://source.android.com/security/apksigning/v2">See APK Signature Scheme V2</a>.
+ *
+ * @see PackageManager#getChecksums
+ */
+ public static final int PARTIAL_MERKLE_ROOT_1M_SHA256 = 0x00000020;
+
+ /**
+ * Root SHA512 hash of a 1M Merkle tree computed over protected content.
+ * Excludes signing block.
+ * <a href="https://source.android.com/security/apksigning/v2">See APK Signature Scheme V2</a>.
+ *
+ * @see PackageManager#getChecksums
+ */
+ public static final int PARTIAL_MERKLE_ROOT_1M_SHA512 = 0x00000040;
+
+ /** @hide */
+ @IntDef(flag = true, prefix = {"WHOLE_", "PARTIAL_"}, value = {
+ WHOLE_MERKLE_ROOT_4K_SHA256,
+ WHOLE_MD5,
+ WHOLE_SHA1,
+ WHOLE_SHA256,
+ WHOLE_SHA512,
+ PARTIAL_MERKLE_ROOT_1M_SHA256,
+ PARTIAL_MERKLE_ROOT_1M_SHA512,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface Kind {}
+
+ /**
+ * Checksum kind.
+ */
+ private final @Checksum.Kind int mKind;
+ /**
+ * Checksum value.
+ */
+ private final @NonNull byte[] mValue;
+
+
+
+ // Code below generated by codegen v1.0.15.
+ //
+ // DO NOT MODIFY!
+ // CHECKSTYLE:OFF Generated code
+ //
+ // To regenerate run:
+ // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/content/pm/Checksum.java
+ //
+ // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
+ // Settings > Editor > Code Style > Formatter Control
+ //@formatter:off
+
+
+ /**
+ * Creates a new Checksum.
+ *
+ * @param kind
+ * Checksum kind.
+ * @param value
+ * Checksum value.
+ * @hide
+ */
+ @DataClass.Generated.Member
+ public Checksum(
+ @Checksum.Kind int kind,
+ @NonNull byte[] value) {
+ this.mKind = kind;
+ com.android.internal.util.AnnotationValidations.validate(
+ Checksum.Kind.class, null, mKind);
+ this.mValue = value;
+ com.android.internal.util.AnnotationValidations.validate(
+ NonNull.class, null, mValue);
+
+ // onConstructed(); // You can define this method to get a callback
+ }
+
+ /**
+ * Checksum kind.
+ */
+ @DataClass.Generated.Member
+ public @Checksum.Kind int getKind() {
+ return mKind;
+ }
+
+ /**
+ * Checksum value.
+ */
+ @DataClass.Generated.Member
+ public @NonNull byte[] getValue() {
+ return mValue;
+ }
+
+ @Override
+ @DataClass.Generated.Member
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ // You can override field parcelling by defining methods like:
+ // void parcelFieldName(Parcel dest, int flags) { ... }
+
+ dest.writeInt(mKind);
+ dest.writeByteArray(mValue);
+ }
+
+ @Override
+ @DataClass.Generated.Member
+ public int describeContents() { return 0; }
+
+ /** @hide */
+ @SuppressWarnings({"unchecked", "RedundantCast"})
+ @DataClass.Generated.Member
+ /* package-private */ Checksum(@NonNull Parcel in) {
+ // You can override field unparcelling by defining methods like:
+ // static FieldType unparcelFieldName(Parcel in) { ... }
+
+ int kind = in.readInt();
+ byte[] value = in.createByteArray();
+
+ this.mKind = kind;
+ com.android.internal.util.AnnotationValidations.validate(
+ Checksum.Kind.class, null, mKind);
+ this.mValue = value;
+ com.android.internal.util.AnnotationValidations.validate(
+ NonNull.class, null, mValue);
+
+ // onConstructed(); // You can define this method to get a callback
+ }
+
+ @DataClass.Generated.Member
+ public static final @NonNull Parcelable.Creator<Checksum> CREATOR
+ = new Parcelable.Creator<Checksum>() {
+ @Override
+ public Checksum[] newArray(int size) {
+ return new Checksum[size];
+ }
+
+ @Override
+ public Checksum createFromParcel(@NonNull Parcel in) {
+ return new Checksum(in);
+ }
+ };
+
+ @DataClass.Generated(
+ time = 1599845646883L,
+ codegenVersion = "1.0.15",
+ sourceFile = "frameworks/base/core/java/android/content/pm/Checksum.java",
+ inputSignatures = "public static final int WHOLE_MERKLE_ROOT_4K_SHA256\npublic static final int WHOLE_MD5\npublic static final int WHOLE_SHA1\npublic static final int WHOLE_SHA256\npublic static final int WHOLE_SHA512\npublic static final int PARTIAL_MERKLE_ROOT_1M_SHA256\npublic static final int PARTIAL_MERKLE_ROOT_1M_SHA512\nprivate final @android.content.pm.Checksum.Kind int mKind\nprivate final @android.annotation.NonNull byte[] mValue\nclass Checksum extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genHiddenConstructor=true, genConstDefs=false)")
+ @Deprecated
+ private void __metadata() {}
+
+
+ //@formatter:on
+ // End of generated code
+
+}
diff --git a/core/java/android/content/pm/IPackageInstallerSession.aidl b/core/java/android/content/pm/IPackageInstallerSession.aidl
index fc20263fe00a..6ccbc36e26f6 100644
--- a/core/java/android/content/pm/IPackageInstallerSession.aidl
+++ b/core/java/android/content/pm/IPackageInstallerSession.aidl
@@ -16,6 +16,7 @@
package android.content.pm;
+import android.content.pm.Checksum;
import android.content.pm.DataLoaderParamsParcel;
import android.content.pm.IPackageInstallObserver2;
import android.content.IntentSender;
@@ -33,6 +34,8 @@ interface IPackageInstallerSession {
void write(String name, long offsetBytes, long lengthBytes, in ParcelFileDescriptor fd);
+ void addChecksums(String name, in Checksum[] checksums);
+
void removeSplit(String splitName);
void close();
diff --git a/core/java/android/content/pm/PackageInstaller.java b/core/java/android/content/pm/PackageInstaller.java
index e6ea04433114..9eb95a3f6707 100644
--- a/core/java/android/content/pm/PackageInstaller.java
+++ b/core/java/android/content/pm/PackageInstaller.java
@@ -1219,6 +1219,31 @@ public class PackageInstaller {
}
/**
+ * Adds installer-provided checksums for the APK file in session.
+ *
+ * @param name previously written as part of this session.
+ * @param checksums installer intends to make available via
+ * {@link PackageManager#getChecksums(String, boolean, int, List,
+ * IntentSender)}.
+ * @throws SecurityException if called after the session has been
+ * committed or abandoned.
+ */
+ public void addChecksums(@NonNull String name, @NonNull List<Checksum> checksums)
+ throws IOException {
+ Objects.requireNonNull(name);
+ Objects.requireNonNull(checksums);
+
+ try {
+ mSession.addChecksums(name, checksums.toArray(new Checksum[checksums.size()]));
+ } catch (RuntimeException e) {
+ ExceptionUtils.maybeUnwrapIOException(e);
+ throw e;
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Attempt to commit everything staged in this session. This may require
* user intervention, and so it may not happen immediately. The final
* result of the commit will be reported through the given callback.
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index d2395ec9f69f..e68df3383642 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -7844,74 +7844,6 @@ public abstract class PackageManager {
}
/**
- * Root SHA256 hash of a 4K Merkle tree computed over all file bytes.
- * <a href="https://source.android.com/security/apksigning/v4">See APK Signature Scheme V4</a>.
- * <a href="https://git.kernel.org/pub/scm/fs/fscrypt/fscrypt.git/tree/Documentation/filesystems/fsverity.rst">See fs-verity</a>.
- *
- * @see #getChecksums
- */
- public static final int WHOLE_MERKLE_ROOT_4K_SHA256 = 0x00000001;
-
- /**
- * MD5 hash computed over all file bytes.
- *
- * @see #getChecksums
- */
- public static final int WHOLE_MD5 = 0x00000002;
-
- /**
- * SHA1 hash computed over all file bytes.
- *
- * @see #getChecksums
- */
- public static final int WHOLE_SHA1 = 0x00000004;
-
- /**
- * SHA256 hash computed over all file bytes.
- *
- * @see #getChecksums
- */
- public static final int WHOLE_SHA256 = 0x00000008;
-
- /**
- * SHA512 hash computed over all file bytes.
- *
- * @see #getChecksums
- */
- public static final int WHOLE_SHA512 = 0x00000010;
-
- /**
- * Root SHA256 hash of a 1M Merkle tree computed over protected content.
- * Excludes signing block.
- * <a href="https://source.android.com/security/apksigning/v2">See APK Signature Scheme V2</a>.
- *
- * @see #getChecksums
- */
- public static final int PARTIAL_MERKLE_ROOT_1M_SHA256 = 0x00000020;
-
- /**
- * Root SHA512 hash of a 1M Merkle tree computed over protected content.
- * Excludes signing block.
- * <a href="https://source.android.com/security/apksigning/v2">See APK Signature Scheme V2</a>.
- *
- * @see #getChecksums
- */
- public static final int PARTIAL_MERKLE_ROOT_1M_SHA512 = 0x00000040;
-
- /** @hide */
- @IntDef(flag = true, prefix = {"WHOLE_", "PARTIAL_"}, value = {
- WHOLE_MERKLE_ROOT_4K_SHA256,
- WHOLE_MD5,
- WHOLE_SHA1,
- WHOLE_SHA256,
- WHOLE_SHA512,
- PARTIAL_MERKLE_ROOT_1M_SHA256,
- PARTIAL_MERKLE_ROOT_1M_SHA512,
- })
- @Retention(RetentionPolicy.SOURCE)
- public @interface FileChecksumKind {}
-
- /**
* Trust any Installer to provide checksums for the package.
* @see #getChecksums
*/
@@ -7940,12 +7872,12 @@ public abstract class PackageManager {
* {@link #TRUST_ALL} will return checksums from any Installer,
* {@link #TRUST_NONE} disables optimized Installer-enforced checksums.
* @param statusReceiver called once when the results are available as
- * {@link #EXTRA_CHECKSUMS} of type FileChecksum[].
+ * {@link #EXTRA_CHECKSUMS} of type ApkChecksum[].
* @throws CertificateEncodingException if an encoding error occurs for trustedInstallers.
* @throws NameNotFoundException if a package with the given name cannot be found on the system.
*/
public void getChecksums(@NonNull String packageName, boolean includeSplits,
- @FileChecksumKind int required, @Nullable List<Certificate> trustedInstallers,
+ @Checksum.Kind int required, @Nullable List<Certificate> trustedInstallers,
@NonNull IntentSender statusReceiver)
throws CertificateEncodingException, IOException, NameNotFoundException {
throw new UnsupportedOperationException("getChecksums not implemented in subclass");