From dafba62268690194e72b8c77c5c39a5e23f8cb71 Mon Sep 17 00:00:00 2001 From: Songchun Fan Date: Wed, 4 Mar 2020 12:30:20 -0800 Subject: [PATCH 1/3] remove incremental.check_loader This workaround was needed to allow non-privileged data loaders. We no longer need it. BUG: 150795871 Test: atest PackageManagerShellCommandIncrementalTest Change-Id: If627e613793e74d86ed67dfebfbdb596147c6c68 --- .../java/com/android/server/pm/DataLoaderManagerService.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/pm/DataLoaderManagerService.java b/services/core/java/com/android/server/pm/DataLoaderManagerService.java index ad20d38e9ed48..8eb773a2d0f81 100644 --- a/services/core/java/com/android/server/pm/DataLoaderManagerService.java +++ b/services/core/java/com/android/server/pm/DataLoaderManagerService.java @@ -116,9 +116,6 @@ public class DataLoaderManagerService extends SystemService { return null; } - // TODO(b/136132412): better way to enable privileged data loaders in tests - boolean checkLoader = - android.os.SystemProperties.getBoolean("incremental.check_loader", false); int numServices = services.size(); for (int i = 0; i < numServices; i++) { ResolveInfo ri = services.get(i); @@ -128,7 +125,7 @@ public class DataLoaderManagerService extends SystemService { // If there's more than one, return the first one found. try { ApplicationInfo ai = pm.getApplicationInfo(resolved.getPackageName(), 0); - if (checkLoader && !ai.isPrivilegedApp()) { + if (!ai.isPrivilegedApp()) { Slog.w(TAG, "Data loader: " + resolved + " is not a privileged app, skipping."); continue; From 41f451bb5cc227a50f5540ccf4230e9346fa2e64 Mon Sep 17 00:00:00 2001 From: Songchun Fan Date: Thu, 5 Mar 2020 15:03:39 -0800 Subject: [PATCH 2/3] fix error message Test: n/a BUG: 150892197 Change-Id: Iea7a5610849ccc53fb4a100f027feba4871ea61e --- core/java/android/service/dataloader/DataLoaderService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/service/dataloader/DataLoaderService.java b/core/java/android/service/dataloader/DataLoaderService.java index 5bf1975a44ff1..0b9a8aff26e89 100644 --- a/core/java/android/service/dataloader/DataLoaderService.java +++ b/core/java/android/service/dataloader/DataLoaderService.java @@ -172,7 +172,7 @@ public abstract class DataLoaderService extends Service { @Override public void prepareImage(InstallationFileParcel[] addedFiles, String[] removedFiles) { if (!nativePrepareImage(mId, addedFiles, removedFiles)) { - Slog.w(TAG, "Failed to destroy loader: " + mId); + Slog.w(TAG, "Failed to prepare image for data loader: " + mId); } } } From 73358eb5f0e78523fdda5fb37a47e414a334d764 Mon Sep 17 00:00:00 2001 From: Songchun Fan Date: Thu, 5 Mar 2020 16:27:03 -0800 Subject: [PATCH 3/3] update javadoc for InstallationFile Also hides the constructor which is only used internally. BUG: 149299379 Test: builds Change-Id: I696e3c5db7b7591276b741f68d50edf47c2f30a0 --- api/system-current.txt | 1 - .../android/content/pm/InstallationFile.java | 36 ++++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index bfdb0529fe7ab..d9029490e4d13 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -2014,7 +2014,6 @@ package android.content.pm { } public final class InstallationFile { - ctor public InstallationFile(int, @NonNull String, long, @Nullable byte[], @Nullable byte[]); method public long getLengthBytes(); method public int getLocation(); method @Nullable public byte[] getMetadata(); diff --git a/core/java/android/content/pm/InstallationFile.java b/core/java/android/content/pm/InstallationFile.java index edc04c9e7248e..de761ad1a305b 100644 --- a/core/java/android/content/pm/InstallationFile.java +++ b/core/java/android/content/pm/InstallationFile.java @@ -21,13 +21,25 @@ import android.annotation.Nullable; import android.annotation.SystemApi; /** - * Defines the properties of a file in an installation session. + * Definition of a file in a streaming installation session. + * You can use this class to retrieve the information of such a file, such as its name, size and + * metadata. These file attributes will be consistent with those used in: + * {@code PackageInstaller.Session#addFile}, when the file was first added into the session. + * + * WARNING: This is a system API to aid internal development. + * Use at your own risk. It will change or be removed without warning. + * + * @see android.content.pm.PackageInstaller.Session#addFile * @hide */ @SystemApi public final class InstallationFile { private final @NonNull InstallationFileParcel mParcel; + /** + * Constructor, internal use only + * @hide + */ public InstallationFile(@PackageInstaller.FileLocation int location, @NonNull String name, long lengthBytes, @Nullable byte[] metadata, @Nullable byte[] signature) { mParcel = new InstallationFileParcel(); @@ -38,22 +50,44 @@ public final class InstallationFile { mParcel.signature = signature; } + /** + * Installation Location of this file. Can be one of the following three locations: + *
    + *
  • (1) {@code PackageInstaller.LOCATION_DATA_APP}
  • + *
  • (2) {@code PackageInstaller.LOCATION_MEDIA_OBB}
  • + *
  • (3) {@code PackageInstaller.LOCATION_MEDIA_DATA}
  • + *
+ * @see android.content.pm.PackageInstaller + * @return Integer that denotes the installation location of the file. + */ public @PackageInstaller.FileLocation int getLocation() { return mParcel.location; } + /** + * @return Name of the file. + */ public @NonNull String getName() { return mParcel.name; } + /** + * @return File size in bytes. + */ public long getLengthBytes() { return mParcel.size; } + /** + * @return File metadata as a byte array + */ public @Nullable byte[] getMetadata() { return mParcel.metadata; } + /** + * @return File signature info as a byte array + */ public @Nullable byte[] getSignature() { return mParcel.signature; }