Fix S to T incremental OTA with XOR disabled
In aosp/2506303 VABCPartitionWriter::PerformSourceCopyOperation
was coded to skip all code path if XOR disabled. But actually, we still
need to write COPY blocks which are converted to a replace.
Test: th
Test: S to T incremental OTA
Bug: 274539246
Change-Id: Ibab15366593fe05834c7bf2234db92a6bff0e858
diff --git a/payload_consumer/vabc_partition_writer.cc b/payload_consumer/vabc_partition_writer.cc
index 2016af7..92f27a9 100644
--- a/payload_consumer/vabc_partition_writer.cc
+++ b/payload_consumer/vabc_partition_writer.cc
@@ -95,6 +95,8 @@
}
copy_blocks_.AddExtent(cow_op.dst_extent());
}
+ LOG(INFO) << "Partition `" << partition_update.partition_name() << " has "
+ << copy_blocks_.blocks() << " copy blocks";
}
bool VABCPartitionWriter::DoesDeviceSupportsXor() {
@@ -273,11 +275,6 @@
// we still want to verify that all blocks contain expected data.
auto source_fd = verified_source_fd_.ChooseSourceFD(operation, error);
TEST_AND_RETURN_FALSE(source_fd != nullptr);
- // For devices not supporting XOR, sequence op is not supported, so all COPY
- // operations are written up front in strict merge order.
- if (!DoesDeviceSupportsXor()) {
- return true;
- }
std::vector<CowOperation> converted;
const auto& src_extents = operation.src_extents();
@@ -286,6 +283,9 @@
BlockIterator it2{dst_extents};
const bool userSnapshots = android::base::GetBoolProperty(
"ro.virtual_ab.userspace.snapshots.enabled", false);
+ // For devices not supporting XOR, sequence op is not supported, so all COPY
+ // operations are written up front in strict merge order.
+ const auto sequence_op_supported = DoesDeviceSupportsXor();
while (!it1.is_end() && !it2.is_end()) {
const auto src_block = *it1;
const auto dst_block = *it2;
@@ -295,7 +295,9 @@
continue;
}
if (copy_blocks_.ContainsBlock(dst_block)) {
- push_back(&converted, {CowOperation::CowCopy, src_block, dst_block, 1});
+ if (sequence_op_supported) {
+ push_back(&converted, {CowOperation::CowCopy, src_block, dst_block, 1});
+ }
} else {
push_back(&converted,
{CowOperation::CowReplace, src_block, dst_block, 1});