aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKelvin Zhang <zhangkelvin@google.com>2022-03-25 22:53:14 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-03-25 22:53:14 +0000
commitb7a66ff8c1f4a996cb206abfabc829c8fa869c01 (patch)
tree07daca8180b162eaaa2ff1b4e74f26314716d77e
parent0452942d6bb4733f786ba2ab1c276d22aae445fb (diff)
parentcf323870b4e1a62525e23ac09f01a33a58f14541 (diff)
downloadupdate_engine-b7a66ff8c1f4a996cb206abfabc829c8fa869c01.tar.gz
Support ZERO op in ota extractor am: cf323870b4
Original change: https://android-review.googlesource.com/c/platform/system/update_engine/+/2045685 Change-Id: Ib98cb104b7167300c6001fd8a5d30a81358917f5 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--aosp/ota_extractor.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/aosp/ota_extractor.cc b/aosp/ota_extractor.cc
index aa0d8230..80bb74bf 100644
--- a/aosp/ota_extractor.cc
+++ b/aosp/ota_extractor.cc
@@ -86,8 +86,19 @@ bool ExtractImagesFromOTA(const DeltaArchiveManifest& manifest,
TEST_AND_RETURN_FALSE(utils::PReadAll(
payload_fd, blob.data(), blob.size(), op_data_offset, &bytes_read));
auto direct_writer = std::make_unique<DirectExtentWriter>(fd);
- TEST_AND_RETURN_FALSE(executor.ExecuteReplaceOperation(
- op, std::move(direct_writer), blob.data(), blob.size()));
+ if (op.type() == InstallOperation::ZERO) {
+ TEST_AND_RETURN_FALSE(executor.ExecuteZeroOrDiscardOperation(
+ op, std::move(direct_writer)));
+ } else if (op.type() == InstallOperation::REPLACE ||
+ op.type() == InstallOperation::REPLACE_BZ ||
+ op.type() == InstallOperation::REPLACE_XZ) {
+ TEST_AND_RETURN_FALSE(executor.ExecuteReplaceOperation(
+ op, std::move(direct_writer), blob.data(), blob.size()));
+ } else {
+ LOG(ERROR) << "Unsupported operation type: " << op.type() << ", "
+ << InstallOperation::Type_Name(op.type());
+ return false;
+ }
}
int err =
truncate64(output_path.c_str(), partition.new_partition_info().size());