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

Commit 2b7b42e3 authored by Songchun Fan's avatar Songchun Fan Committed by Android (Google) Code Review
Browse files

Merge "Fix incremental installation"

parents b27d2829 9439be2d
Loading
Loading
Loading
Loading
+13 −12
Original line number Diff line number Diff line
@@ -2413,16 +2413,6 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {

    @Override
    public void addFile(String name, long lengthBytes, byte[] metadata) {
        if (mIncrementalFileStorages != null) {
            try {
                mIncrementalFileStorages.addFile(new InstallationFile(name, lengthBytes, metadata));
                //TODO(b/136132412): merge incremental and callback installation schemes
                return;
            } catch (IOException ex) {
                throw new IllegalStateException(
                        "Failed to add and configure Incremental File: " + name, ex);
            }
        }
        if (!isDataLoaderInstallation()) {
            throw new IllegalStateException(
                    "Cannot add files to non-data loader installation session.");
@@ -2435,7 +2425,6 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
        synchronized (mLock) {
            assertCallerIsOwnerOrRootLocked();
            assertPreparedAndNotSealedLocked("addFile");

            mFiles.add(FileInfo.added(name, lengthBytes, metadata));
        }
    }
@@ -2486,7 +2475,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
     */
    private void prepareDataLoader()
            throws PackageManagerException, StreamingException {
        if (!isStreamingInstallation()) {
        if (!isDataLoaderInstallation()) {
            return;
        }

@@ -2500,6 +2489,18 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
                    file -> file.name.substring(
                            0, file.name.length() - REMOVE_MARKER_EXTENSION.length())).collect(
                Collectors.toList());
        if (mIncrementalFileStorages != null) {
            for (InstallationFile file : addedFiles) {
                try {
                    mIncrementalFileStorages.addFile(file);
                } catch (IOException ex) {
                    // TODO(b/146080380): add incremental-specific error code
                    throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR,
                            "Failed to add and configure Incremental File: " + file.getName(), ex);
                }
            }
            return;
        }

        final FileSystemConnector connector = new FileSystemConnector(addedFiles);