Moving cow_size_updates to before partitions are parsed. am: 4565a2e8e6 am: c3d9de7ba9
Original change: https://android-review.googlesource.com/c/platform/system/update_engine/+/2224657
Change-Id: Ic42e3409a878328098c937cd5c8facc290453224
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/payload_consumer/delta_performer.cc b/payload_consumer/delta_performer.cc
index 608c2f3..776eb2d 100644
--- a/payload_consumer/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -463,6 +463,28 @@
CheckSPLDowngrade();
+ // update estimate_cow_size if VABC is disabled
+ // new_cow_size per partition = partition_size - (#blocks in Copy
+ // operations part of the partition)
+ if (install_plan_->disable_vabc) {
+ LOG(INFO) << "Disabling VABC";
+ manifest_.mutable_dynamic_partition_metadata()
+ ->set_vabc_compression_param("none");
+ for (auto& partition : *manifest_.mutable_partitions()) {
+ int new_cow_size = partition.new_partition_info().size();
+ for (const auto& operation : partition.merge_operations()) {
+ if (operation.type() == CowMergeOperation::COW_COPY) {
+ new_cow_size -=
+ operation.dst_extent().num_blocks() * manifest_.block_size();
+ }
+ }
+ // Adding extra 8MB headroom. OTA will sometimes write labels/metadata
+ // to COW image. If we overrun reserved COW size, entire OTA will fail
+ // and no way for user to retry OTA
+ partition.set_estimate_cow_size(new_cow_size + (1024 * 1024 * 8));
+ }
+ }
+
// This populates |partitions_| and the |install_plan.partitions| with the
// list of partitions from the manifest.
if (!ParseManifestPartitions(error))
@@ -488,27 +510,6 @@
metadata_signature_size_))
<< "Unable to save the manifest signature size.";
- // update estimate_cow_size if VABC is disabled
- // new_cow_size per partition = partition_size - (#blocks in Copy
- // operations part of the partition)
- if (install_plan_->disable_vabc) {
- manifest_.mutable_dynamic_partition_metadata()
- ->set_vabc_compression_param("none");
- for (auto& partition : *manifest_.mutable_partitions()) {
- int new_cow_size = partition.new_partition_info().size();
- for (const auto& operation : partition.merge_operations()) {
- if (operation.type() == CowMergeOperation::COW_COPY) {
- new_cow_size -=
- operation.dst_extent().num_blocks() * manifest_.block_size();
- }
- }
- // Adding extra 8MB headroom. OTA will sometimes write labels/metadata
- // to COW image. If we overrun reserved COW size, entire OTA will fail
- // and no way for user to retry OTA
- partition.set_estimate_cow_size(new_cow_size + (1024 * 1024 * 8));
- }
- }
-
if (!PrimeUpdateState()) {
*error = ErrorCode::kDownloadStateInitializationError;
LOG(ERROR) << "Unable to prime the update state.";