Verify the extents for untouched dynamic partitions during partial update
For partial updates, the metadata for untouched dynamic partitions
are just copied over to the target slot. So, verifying the extents
of these partitions in the target metadata should be sufficient for
correctness. This saves the work to read & hash the bytes on these
partitions for each resumed update.
Bug: 151088567
Test: unit tests pass, apply a partial update
Change-Id: I9d40ed2643e145a1546ea17b146fcdcfb91f213f
diff --git a/payload_consumer/delta_performer.cc b/payload_consumer/delta_performer.cc
index af1baa4..7d837db 100644
--- a/payload_consumer/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -806,15 +806,32 @@
auto generator = partition_update_generator::Create(boot_control_,
manifest_.block_size());
- std::vector<PartitionUpdate> other_partitions;
+ std::vector<PartitionUpdate> untouched_static_partitions;
TEST_AND_RETURN_FALSE(
generator->GenerateOperationsForPartitionsNotInPayload(
install_plan_->source_slot,
install_plan_->target_slot,
touched_partitions,
- &other_partitions));
- partitions_.insert(
- partitions_.end(), other_partitions.begin(), other_partitions.end());
+ &untouched_static_partitions));
+ partitions_.insert(partitions_.end(),
+ untouched_static_partitions.begin(),
+ untouched_static_partitions.end());
+
+ // Save the untouched dynamic partitions in install plan.
+ std::vector<std::string> dynamic_partitions;
+ if (!boot_control_->GetDynamicPartitionControl()
+ ->ListDynamicPartitionsForSlot(install_plan_->source_slot,
+ &dynamic_partitions)) {
+ LOG(ERROR) << "Failed to load dynamic partitions from slot "
+ << install_plan_->source_slot;
+ return false;
+ }
+ install_plan_->untouched_dynamic_partitions.clear();
+ for (const auto& name : dynamic_partitions) {
+ if (touched_partitions.find(name) == touched_partitions.end()) {
+ install_plan_->untouched_dynamic_partitions.push_back(name);
+ }
+ }
}
// Fill in the InstallPlan::partitions based on the partitions from the