Moving cow_size_updates to before partitions are parsed.

Test: tested compilation + OTA. Increased OTA speeds by 20% when VABC is
disabled.

Bug: 242855315
Change-Id: I5f9df93abe5558d950b73324f76f3a12f2fd6a6c
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.";