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

Commit a8cfbe87 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Installation hardening: reducing read timeout during installation." into sc-dev

parents c0806538 c144cc45
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -52,6 +52,11 @@ interface IIncrementalService {
                         in IStorageHealthListener healthListener,
                         in PerUidReadTimeouts[] perUidReadTimeouts);

    /**
     * PM/system is done with this storage, ok to increase timeouts.
     */
    void onInstallationComplete(int storageId);

    /**
     * Bind-mounts a path under a storage to a full path. Can be permanent or temporary.
     */
+15 −5
Original line number Diff line number Diff line
@@ -205,16 +205,26 @@ public final class IncrementalFileStorages {
    /**
     * Resets the states and unbinds storage instances for an installation session.
     */
    public void cleanUp() {
        if (mDefaultStorage == null) {
            return;
    public void cleanUpAndMarkComplete() {
        IncrementalStorage defaultStorage = cleanUp();
        if (defaultStorage != null) {
            defaultStorage.onInstallationComplete();
        }
    }

    private IncrementalStorage cleanUp() {
        IncrementalStorage defaultStorage = mDefaultStorage;
        mInheritedStorage = null;
        mDefaultStorage = null;
        if (defaultStorage == null) {
            return null;
        }

        try {
            mIncrementalManager.unregisterLoadingProgressCallbacks(mStageDir.getAbsolutePath());
            mDefaultStorage.unBind(mStageDir.getAbsolutePath());
            defaultStorage.unBind(mStageDir.getAbsolutePath());
        } catch (IOException ignored) {
        }
        mDefaultStorage = null;
        return defaultStorage;
    }
}
+13 −1
Original line number Diff line number Diff line
@@ -398,7 +398,7 @@ public final class IncrementalStorage {
    }

    /**
     * Iinitializes and starts the DataLoader.
     * Initializes and starts the DataLoader.
     * This makes sure all install-time parameters are applied.
     * Does not affect persistent DataLoader params.
     * @return True if start request was successfully queued.
@@ -419,6 +419,18 @@ public final class IncrementalStorage {
        }
    }

    /**
     * Marks the completion of installation.
     */
    public void onInstallationComplete() {
        try {
            mService.onInstallationComplete(mId);
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
        }
    }


    private static final int UUID_BYTE_SIZE = 16;

    /**
+2 −2
Original line number Diff line number Diff line
@@ -4157,7 +4157,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
        if (stageDir != null && !params.isStaged) {
            try {
                if (incrementalFileStorages != null) {
                    incrementalFileStorages.cleanUp();
                    incrementalFileStorages.cleanUpAndMarkComplete();
                }
                mPm.mInstaller.rmPackageDir(stageDir.getAbsolutePath());
            } catch (InstallerException ignored) {
@@ -4183,7 +4183,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
        }
        try {
            if (incrementalFileStorages != null) {
                incrementalFileStorages.cleanUp();
                incrementalFileStorages.cleanUpAndMarkComplete();
            }
            mPm.mInstaller.rmPackageDir(stageDir.getAbsolutePath());
        } catch (InstallerException ignored) {
+5 −0
Original line number Diff line number Diff line
@@ -150,6 +150,11 @@ binder::Status BinderIncrementalService::startLoading(
    return ok();
}

binder::Status BinderIncrementalService::onInstallationComplete(int32_t storageId) {
    mImpl.onInstallationComplete(storageId);
    return ok();
}

binder::Status BinderIncrementalService::makeBindMount(int32_t storageId,
                                                       const std::string& sourcePath,
                                                       const std::string& targetFullPath,
Loading