Merge "dataloader/incfs openWrite returns int" into rvc-dev am: 1f9875dc17
Change-Id: Ibfe2e079ee357a125ad09f976aeab0130e7bd261
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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))) {
|
||||
signature = V4Signature.readFrom(input);
|
||||
try {
|
||||
signature = V4Signature.readFrom(input);
|
||||
} catch (IOException e) {
|
||||
throw new IOException("Failed to read v4 signature:", e);
|
||||
}
|
||||
}
|
||||
|
||||
if (!signature.isVersionSupported()) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user