Report retrofit and COW image size

Add is_vab_retrofit (that tells if the device upgraded to Virtual A/B or
was natively supporting the feature) and cow_file_size_bytes (the total
size of the space allocated in /data for the dm-snapshot COW images).

Bug: 154016862
Test: Manual OTA
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: I529028bc208b7dd12df0bc28974f65b821d14cd9
diff --git a/cleanup_previous_update_action.cc b/cleanup_previous_update_action.cc
index e43730d..88dbc57 100644
--- a/cleanup_previous_update_action.cc
+++ b/cleanup_previous_update_action.cc
@@ -343,7 +343,9 @@
     return;
   }
 
-  if (snapshot_->InitiateMerge()) {
+  uint64_t cow_file_size;
+  if (snapshot_->InitiateMerge(&cow_file_size)) {
+    merge_stats_->set_cow_file_size(cow_file_size);
     WaitForMergeOrSchedule();
     return;
   }
@@ -399,14 +401,22 @@
 
   auto passed_ms = std::chrono::duration_cast<std::chrono::milliseconds>(
       result->merge_time());
+
+  bool vab_retrofit = boot_control_->GetDynamicPartitionControl()
+                          ->GetVirtualAbFeatureFlag()
+                          .IsRetrofit();
+
   LOG(INFO) << "Reporting merge stats: "
             << android::snapshot::UpdateState_Name(report.state()) << " in "
             << passed_ms.count() << "ms (resumed " << report.resume_count()
-            << " times)";
+            << " times), using " << report.cow_file_size()
+            << " bytes of COW image.";
   android::util::stats_write(android::util::SNAPSHOT_MERGE_REPORTED,
                              static_cast<int32_t>(report.state()),
                              static_cast<int64_t>(passed_ms.count()),
-                             static_cast<int32_t>(report.resume_count()));
+                             static_cast<int32_t>(report.resume_count()),
+                             vab_retrofit,
+                             static_cast<int64_t>(report.cow_file_size()));
 #endif
 }