From 8e8807472cdceca8bc6a004effda2b9d320ffde0 Mon Sep 17 00:00:00 2001 From: Sumedh Sen Date: Tue, 21 Nov 2023 18:36:25 -0800 Subject: Add missing api flags in package manager Add missing API flags to readInstallInfo and calculateInstalledSize in PackageInstaller. These API were added to read install related informaion from an APK file Bug: 301713559 Test: presubmit Change-Id: I89339410a5e0474f63ec5b09bf6331f85c87d4b2 --- core/api/system-current.txt | 4 ++-- core/java/android/content/pm/PackageInstaller.java | 2 ++ core/java/android/content/pm/flags.aconfig | 7 +++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 275fe7790e84..01821fdd7bca 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -3867,7 +3867,7 @@ package android.content.pm { public class PackageInstaller { method @NonNull public android.content.pm.PackageInstaller.InstallInfo readInstallInfo(@NonNull java.io.File, int) throws android.content.pm.PackageInstaller.PackageParsingException; - method @NonNull public android.content.pm.PackageInstaller.InstallInfo readInstallInfo(@NonNull android.os.ParcelFileDescriptor, @Nullable String, int) throws android.content.pm.PackageInstaller.PackageParsingException; + method @FlaggedApi("android.content.pm.read_install_info") @NonNull public android.content.pm.PackageInstaller.InstallInfo readInstallInfo(@NonNull android.os.ParcelFileDescriptor, @Nullable String, int) throws android.content.pm.PackageInstaller.PackageParsingException; method @FlaggedApi("android.content.pm.archiving") @RequiresPermission(anyOf={android.Manifest.permission.INSTALL_PACKAGES, android.Manifest.permission.REQUEST_INSTALL_PACKAGES}) public void reportUnarchivalStatus(int, int, long, @Nullable android.app.PendingIntent) throws android.content.pm.PackageManager.NameNotFoundException; method @FlaggedApi("android.content.pm.archiving") @RequiresPermission(anyOf={android.Manifest.permission.DELETE_PACKAGES, android.Manifest.permission.REQUEST_DELETE_PACKAGES}) public void requestArchive(@NonNull String, @NonNull android.content.IntentSender) throws android.content.pm.PackageManager.NameNotFoundException; method @FlaggedApi("android.content.pm.archiving") @RequiresPermission(anyOf={android.Manifest.permission.INSTALL_PACKAGES, android.Manifest.permission.REQUEST_INSTALL_PACKAGES}) public void requestUnarchive(@NonNull String, @NonNull android.content.IntentSender) throws java.io.IOException, android.content.pm.PackageManager.NameNotFoundException; @@ -3902,7 +3902,7 @@ package android.content.pm { public static class PackageInstaller.InstallInfo { method public long calculateInstalledSize(@NonNull android.content.pm.PackageInstaller.SessionParams) throws java.io.IOException; - method public long calculateInstalledSize(@NonNull android.content.pm.PackageInstaller.SessionParams, @NonNull android.os.ParcelFileDescriptor) throws java.io.IOException; + method @FlaggedApi("android.content.pm.read_install_info") public long calculateInstalledSize(@NonNull android.content.pm.PackageInstaller.SessionParams, @NonNull android.os.ParcelFileDescriptor) throws java.io.IOException; method public int getInstallLocation(); method @NonNull public String getPackageName(); } diff --git a/core/java/android/content/pm/PackageInstaller.java b/core/java/android/content/pm/PackageInstaller.java index 4f0bfc7437c7..6df1f600c3ef 100644 --- a/core/java/android/content/pm/PackageInstaller.java +++ b/core/java/android/content/pm/PackageInstaller.java @@ -2337,6 +2337,7 @@ public class PackageInstaller { */ @SystemApi @NonNull + @FlaggedApi(Flags.FLAG_READ_INSTALL_INFO) public InstallInfo readInstallInfo(@NonNull ParcelFileDescriptor pfd, @Nullable String debugPathName, int flags) throws PackageParsingException { final ParseTypeImpl input = ParseTypeImpl.forDefaultParsing(); @@ -2516,6 +2517,7 @@ public class PackageInstaller { * and all relevant native code. * @throws IOException when size of native binaries cannot be calculated. */ + @FlaggedApi(Flags.FLAG_READ_INSTALL_INFO) public long calculateInstalledSize(@NonNull SessionParams params, @NonNull ParcelFileDescriptor pfd) throws IOException { return InstallLocationUtils.calculateInstalledSize(mPkg, params.abiOverride, diff --git a/core/java/android/content/pm/flags.aconfig b/core/java/android/content/pm/flags.aconfig index bb5fdb714761..a565f6825e7a 100644 --- a/core/java/android/content/pm/flags.aconfig +++ b/core/java/android/content/pm/flags.aconfig @@ -87,3 +87,10 @@ flag { description: "Feature flag to detect the invisible labels in Launcher Apps" bug: "299586370" } + +flag { + name: "read_install_info" + namespace: "package_manager_service" + description: "Feature flag to read install related information from an APK." + bug: "275658500" +} -- cgit v1.2.3-59-g8ed1b