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

Commit d80227ca authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "dataloader/incfs openWrite returns int" into rvc-dev am: 1f9875dc

Change-Id: Ibfe2e079ee357a125ad09f976aeab0130e7bd261
parents f4cae7af 1f9875dc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -101,8 +101,7 @@ public final class IncrementalFileStorages {
                    } catch (IOException e) {
                        // TODO(b/146080380): add incremental-specific error code
                        throw new IOException(
                                "Failed to add file to IncFS: " + file.getName() + ", reason: "
                                        + e.getMessage(), e.getCause());
                                "Failed to add file to IncFS: " + file.getName() + ", reason: ", e);
                    }
                } else {
                    throw new IOException("Unknown file location: " + file.getLocation());
@@ -117,6 +116,7 @@ public final class IncrementalFileStorages {

            return result;
        } catch (IOException e) {
            Slog.e(TAG, "Failed to initialize Incremental file storages. Cleaning up...", e);
            if (result != null) {
                result.cleanUp();
            }
+6 −2
Original line number Diff line number Diff line
@@ -424,14 +424,18 @@ public final class IncrementalStorage {
     */
    private static IncrementalSignature parseV4Signature(@Nullable byte[] v4signatureBytes)
            throws IOException {
        if (v4signatureBytes == null) {
        if (v4signatureBytes == null || v4signatureBytes.length == 0) {
            return null;
        }

        final V4Signature signature;
        try (DataInputStream input = new DataInputStream(
                new ByteArrayInputStream(v4signatureBytes))) {
            try {
                signature = V4Signature.readFrom(input);
            } catch (IOException e) {
                throw new IOException("Failed to read v4 signature:", e);
            }
        }

        if (!signature.isVersionSupported()) {
+7 −10
Original line number Diff line number Diff line
@@ -16,22 +16,17 @@

#define ATRACE_TAG ATRACE_TAG_ADB
#define LOG_TAG "PackageManagerShellCommandDataLoader-jni"
#include <android-base/logging.h>

#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
#include <core_jni_helpers.h>
#include <cutils/trace.h>
#include <endian.h>
#include <nativehelper/JNIHelp.h>
#include <sys/eventfd.h>
#include <sys/poll.h>

#include <nativehelper/JNIHelp.h>

#include <core_jni_helpers.h>
#include <endian.h>

#include "dataloader.h"

#include <charconv>
#include <chrono>
#include <span>
@@ -40,6 +35,8 @@
#include <unordered_map>
#include <unordered_set>

#include "dataloader.h"

namespace android {

namespace {
@@ -681,7 +678,7 @@ private:

                auto& writeFd = writeFds[fileIdx];
                if (writeFd < 0) {
                    writeFd = this->mIfs->openWrite(fileId);
                    writeFd.reset(this->mIfs->openWrite(fileId));
                    if (writeFd < 0) {
                        ALOGE("Failed to open file %d for writing (%d). Aboring.", header.fileIdx,
                              -writeFd);