Merge "Making the rest of Streaming installation API public." into sc-dev

This commit is contained in:
Alex Buynytskyy
2021-03-25 23:58:06 +00:00
committed by Android (Google) Code Review
5 changed files with 39 additions and 56 deletions

View File

@@ -12090,6 +12090,14 @@ package android.content.pm {
field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.InstallSourceInfo> CREATOR;
}
public final class InstallationFile {
method public long getLengthBytes();
method public int getLocation();
method @Nullable public byte[] getMetadata();
method @NonNull public String getName();
method @Nullable public byte[] getSignature();
}
public class InstrumentationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
ctor public InstrumentationInfo();
ctor public InstrumentationInfo(android.content.pm.InstrumentationInfo);
@@ -12328,6 +12336,7 @@ package android.content.pm {
method @NonNull public java.io.InputStream openRead(@NonNull String) throws java.io.IOException;
method @NonNull public java.io.OutputStream openWrite(@NonNull String, long, long) throws java.io.IOException;
method public void removeChildSessionId(int);
method public void removeFile(int, @NonNull String);
method public void removeSplit(@NonNull String) throws java.io.IOException;
method @Deprecated public void setChecksums(@NonNull String, @NonNull java.util.List<android.content.pm.Checksum>, @Nullable byte[]) throws java.io.IOException;
method public void setStagingProgress(float);
@@ -38291,6 +38300,25 @@ package android.service.controls.templates {
}
package android.service.dataloader {
public abstract class DataLoaderService extends android.app.Service {
ctor public DataLoaderService();
method @NonNull public final android.os.IBinder onBind(@NonNull android.content.Intent);
method @Nullable public android.service.dataloader.DataLoaderService.DataLoader onCreateDataLoader(@NonNull android.content.pm.DataLoaderParams);
}
public static interface DataLoaderService.DataLoader {
method public boolean onCreate(@NonNull android.content.pm.DataLoaderParams, @NonNull android.service.dataloader.DataLoaderService.FileSystemConnector);
method public boolean onPrepareImage(@NonNull java.util.Collection<android.content.pm.InstallationFile>, @NonNull java.util.Collection<java.lang.String>);
}
public static final class DataLoaderService.FileSystemConnector {
method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void writeData(@NonNull String, long, long, @NonNull android.os.ParcelFileDescriptor) throws java.io.IOException;
}
}
package android.service.dreams {
public class DreamService extends android.app.Service implements android.view.Window.Callback {

View File

@@ -2483,14 +2483,6 @@ package android.content.pm {
method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_PROFILES) public void startActivity(@NonNull android.content.ComponentName, @NonNull android.os.UserHandle);
}
public final class InstallationFile {
method public long getLengthBytes();
method public int getLocation();
method @Nullable public byte[] getMetadata();
method @NonNull public String getName();
method @Nullable public byte[] getSignature();
}
public final class InstantAppInfo implements android.os.Parcelable {
ctor public InstantAppInfo(android.content.pm.ApplicationInfo, String[], String[]);
ctor public InstantAppInfo(String, CharSequence, String[], String[]);
@@ -2585,7 +2577,6 @@ package android.content.pm {
public static class PackageInstaller.Session implements java.io.Closeable {
method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void commitTransferred(@NonNull android.content.IntentSender);
method public void removeFile(int, @NonNull String);
}
public static class PackageInstaller.SessionInfo implements android.os.Parcelable {
@@ -9757,24 +9748,6 @@ package android.service.contentsuggestions {
}
package android.service.dataloader {
public abstract class DataLoaderService extends android.app.Service {
ctor public DataLoaderService();
method @Nullable public android.service.dataloader.DataLoaderService.DataLoader onCreateDataLoader(@NonNull android.content.pm.DataLoaderParams);
}
public static interface DataLoaderService.DataLoader {
method public boolean onCreate(@NonNull android.content.pm.DataLoaderParams, @NonNull android.service.dataloader.DataLoaderService.FileSystemConnector);
method public boolean onPrepareImage(@NonNull java.util.Collection<android.content.pm.InstallationFile>, @NonNull java.util.Collection<java.lang.String>);
}
public static final class DataLoaderService.FileSystemConnector {
method @RequiresPermission(android.Manifest.permission.INSTALL_PACKAGES) public void writeData(@NonNull String, long, long, @NonNull android.os.ParcelFileDescriptor) throws java.io.IOException;
}
}
package android.service.displayhash {
public final class DisplayHashParams implements android.os.Parcelable {

View File

@@ -18,21 +18,16 @@ package android.content.pm;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
/**
* 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.
* {@code android.content.pm.PackageInstaller.Session#addFile}, when the file was first added
* into the session.
*
* @see android.content.pm.PackageInstaller.Session#addFile
* @hide
*/
@SystemApi
public final class InstallationFile {
private final @NonNull InstallationFileParcel mParcel;

View File

@@ -1165,7 +1165,8 @@ public class PackageInstaller {
}
/**
* Adds a file to session. On commit this file will be pulled from dataLoader.
* Adds a file to session. On commit this file will be pulled from dataLoader {@code
* android.service.dataloader.DataLoaderService.DataLoader}.
*
* @param location target location for the file. Possible values:
* {@link #LOCATION_DATA_APP},
@@ -1184,7 +1185,9 @@ public class PackageInstaller {
* <a href="https://source.android.com/security/apksigning/v4.html">APK Signature Scheme v4</a>
* @throws SecurityException if called after the session has been
* sealed or abandoned
* @throws IllegalStateException if called for non-callback session
* @throws IllegalStateException if called for non-streaming session
*
* @see android.content.pm.InstallationFile
*/
public void addFile(@FileLocation int location, @NonNull String name, long lengthBytes,
@NonNull byte[] metadata, @Nullable byte[] signature) {
@@ -1205,10 +1208,8 @@ public class PackageInstaller {
* @param name name of a file, e.g. split.
* @throws SecurityException if called after the session has been
* sealed or abandoned
* @throws IllegalStateException if called for non-callback session
* {@hide}
* @throws IllegalStateException if called for non-streaming session
*/
@SystemApi
public void removeFile(@FileLocation int location, @NonNull String name) {
try {
mSession.removeFile(location, name);
@@ -2024,6 +2025,8 @@ public class PackageInstaller {
* Set the data loader params for the session.
* This also switches installation into data provider mode and disallow direct writes into
* staging folder.
*
* @see android.service.dataloader.DataLoaderService.DataLoader
*/
public void setDataLoaderParams(@NonNull DataLoaderParams dataLoaderParams) {
this.dataLoaderParams = dataLoaderParams;

View File

@@ -19,7 +19,6 @@ package android.service.dataloader;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.app.Service;
import android.content.Intent;
import android.content.pm.DataLoaderParams;
@@ -41,25 +40,15 @@ import java.util.Collection;
/**
* The base class for implementing data loader service to control data loaders. Expecting
* Incremental Service to bind to a children class of this.
*
* WARNING: This is a system API to aid internal development.
* Use at your own risk. It will change or be removed without warning.
*
* TODO(b/136132412): update with latest API design
*
* @hide
* Installation Session to bind to a children class of this.
*/
@SystemApi
public abstract class DataLoaderService extends Service {
private static final String TAG = "DataLoaderService";
private final DataLoaderBinderService mBinder = new DataLoaderBinderService();
/**
* Managed DataLoader interface. Each instance corresponds to a single installation session.
* @hide
*/
@SystemApi
public interface DataLoader {
/**
* A virtual constructor.
@@ -88,9 +77,7 @@ public abstract class DataLoaderService extends Service {
* DataLoader factory method.
*
* @return An instance of a DataLoader.
* @hide
*/
@SystemApi
public @Nullable DataLoader onCreateDataLoader(@NonNull DataLoaderParams dataLoaderParams) {
return null;
}
@@ -156,10 +143,7 @@ public abstract class DataLoaderService extends Service {
/**
* Used by the DataLoaderService implementations.
*
* @hide
*/
@SystemApi
public static final class FileSystemConnector {
/**
* Create a wrapper for a native instance.