Support ZERO op in ota extractor am: cf323870b4 am: b7a66ff8c1
Original change: https://android-review.googlesource.com/c/platform/system/update_engine/+/2045685
Change-Id: I79c73687b0e13ca45e7f13007849a9a98d6c3a96
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/aosp/ota_extractor.cc b/aosp/ota_extractor.cc
index aa0d823..80bb74b 100644
--- a/aosp/ota_extractor.cc
+++ b/aosp/ota_extractor.cc
@@ -86,8 +86,19 @@
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());