Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa8e95ea authored by Alex Buynytskyy's avatar Alex Buynytskyy
Browse files

Per package read timeouts.

Bug: 162345970
Test: atest PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest IncrementalServiceTest PackageManagerServiceTest

Change-Id: I2599db1ed8827fff16387c11254a5d607f27ea46
parent 55b6a818
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1115,6 +1115,7 @@ filegroup {
        "core/java/android/os/incremental/IStorageLoadingProgressListener.aidl",
        "core/java/android/os/incremental/IncrementalNewFileParams.aidl",
        "core/java/android/os/incremental/IStorageHealthListener.aidl",
        "core/java/android/os/incremental/PerUidReadTimeouts.aidl",
        "core/java/android/os/incremental/StorageHealthCheckParams.aidl",
    ],
    path: "core/java",
+4 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.pm.IDataLoaderStatusListener;
import android.os.incremental.IncrementalNewFileParams;
import android.os.incremental.IStorageLoadingProgressListener;
import android.os.incremental.IStorageHealthListener;
import android.os.incremental.PerUidReadTimeouts;
import android.os.incremental.StorageHealthCheckParams;

/** @hide */
@@ -40,7 +41,8 @@ interface IIncrementalService {
    int createStorage(in @utf8InCpp String path, in DataLoaderParamsParcel params, int createMode,
                      in IDataLoaderStatusListener statusListener,
                      in StorageHealthCheckParams healthCheckParams,
                      in IStorageHealthListener healthListener);
                      in IStorageHealthListener healthListener,
                      in PerUidReadTimeouts[] perUidReadTimeouts);
    int createLinkedStorage(in @utf8InCpp String path, int otherStorageId, int createMode);

    /**
@@ -123,7 +125,7 @@ interface IIncrementalService {
    /**
     * Permanently disable readlogs reporting for a storage given its ID.
     */
    void disableReadLogs(int storageId);
    void disallowReadLogs(int storageId);

    /**
     * Setting up native library directories and extract native libs onto a storage if needed.
+8 −6
Original line number Diff line number Diff line
@@ -69,7 +69,8 @@ public final class IncrementalFileStorages {
            @Nullable IDataLoaderStatusListener statusListener,
            @Nullable StorageHealthCheckParams healthCheckParams,
            @Nullable IStorageHealthListener healthListener,
            List<InstallationFileParcel> addedFiles) throws IOException {
            @NonNull List<InstallationFileParcel> addedFiles,
            @NonNull PerUidReadTimeouts[] perUidReadTimeouts) throws IOException {
        // TODO(b/136132412): validity check if session should not be incremental
        IncrementalManager incrementalManager = (IncrementalManager) context.getSystemService(
                Context.INCREMENTAL_SERVICE);
@@ -80,7 +81,7 @@ public final class IncrementalFileStorages {

        final IncrementalFileStorages result = new IncrementalFileStorages(stageDir,
                incrementalManager, dataLoaderParams, statusListener, healthCheckParams,
                healthListener);
                healthListener, perUidReadTimeouts);
        for (InstallationFileParcel file : addedFiles) {
            if (file.location == LOCATION_DATA_APP) {
                try {
@@ -105,7 +106,8 @@ public final class IncrementalFileStorages {
            @NonNull DataLoaderParams dataLoaderParams,
            @Nullable IDataLoaderStatusListener statusListener,
            @Nullable StorageHealthCheckParams healthCheckParams,
            @Nullable IStorageHealthListener healthListener) throws IOException {
            @Nullable IStorageHealthListener healthListener,
            @NonNull PerUidReadTimeouts[] perUidReadTimeouts) throws IOException {
        try {
            mStageDir = stageDir;
            mIncrementalManager = incrementalManager;
@@ -124,7 +126,7 @@ public final class IncrementalFileStorages {
                mDefaultStorage = mIncrementalManager.createStorage(stageDir.getAbsolutePath(),
                        dataLoaderParams, IncrementalManager.CREATE_MODE_CREATE
                                | IncrementalManager.CREATE_MODE_TEMPORARY_BIND, false,
                        statusListener, healthCheckParams, healthListener);
                        statusListener, healthCheckParams, healthListener, perUidReadTimeouts);
                if (mDefaultStorage == null) {
                    throw new IOException(
                            "Couldn't create incremental storage at " + stageDir);
@@ -163,8 +165,8 @@ public final class IncrementalFileStorages {
    /**
     * Permanently disables readlogs.
     */
    public void disableReadLogs() {
        mDefaultStorage.disableReadLogs();
    public void disallowReadLogs() {
        mDefaultStorage.disallowReadLogs();
    }

    /**
+7 −2
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Objects;

/**
 * Provides operations to open or create an IncrementalStorage, using IIncrementalService
@@ -104,10 +105,14 @@ public final class IncrementalManager {
            boolean autoStartDataLoader,
            @Nullable IDataLoaderStatusListener statusListener,
            @Nullable StorageHealthCheckParams healthCheckParams,
            @Nullable IStorageHealthListener healthListener) {
            @Nullable IStorageHealthListener healthListener,
            @NonNull PerUidReadTimeouts[] perUidReadTimeouts) {
        Objects.requireNonNull(path);
        Objects.requireNonNull(params);
        Objects.requireNonNull(perUidReadTimeouts);
        try {
            final int id = mService.createStorage(path, params.getData(), createMode,
                    statusListener, healthCheckParams, healthListener);
                    statusListener, healthCheckParams, healthListener, perUidReadTimeouts);
            if (id < 0) {
                return null;
            }
+2 −2
Original line number Diff line number Diff line
@@ -432,9 +432,9 @@ public final class IncrementalStorage {
    /**
     * Permanently disable readlogs collection.
     */
    public void disableReadLogs() {
    public void disallowReadLogs() {
        try {
            mService.disableReadLogs(mId);
            mService.disallowReadLogs(mId);
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
        }
Loading