Add COW version to the update_metadata.proto

COW versioning will be used to detect if the COW library
version matches with the version in the proto file.
If not, VABC is disabled.

Bug: 183863613
Test: Apply OTA and verifiy if VABC is disabled if the versioning
doesn't match
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I2d8690bd30d3436c6eb281d3e8d6545cb4888a75
diff --git a/payload_generator/payload_generation_config.cc b/payload_generator/payload_generation_config.cc
index d45de6a..2cd2ebc 100644
--- a/payload_generator/payload_generation_config.cc
+++ b/payload_generator/payload_generation_config.cc
@@ -23,6 +23,7 @@
 #include <base/logging.h>
 #include <base/strings/string_number_conversions.h>
 #include <brillo/strings/string_utils.h>
+#include <libsnapshot/cow_format.h>
 
 #include "update_engine/common/utils.h"
 #include "update_engine/payload_consumer/delta_performer.h"
@@ -185,6 +186,7 @@
   // We use "gz" compression by default for VABC.
   if (metadata->vabc_enabled()) {
     metadata->set_vabc_compression_param("gz");
+    metadata->set_cow_version(android::snapshot::kCowVersionManifest);
   }
   dynamic_partition_metadata = std::move(metadata);
   return true;
diff --git a/update_metadata.proto b/update_metadata.proto
index bc9e34a..93e4e2e 100644
--- a/update_metadata.proto
+++ b/update_metadata.proto
@@ -359,6 +359,10 @@
   // See system/core/fs_mgr/libsnapshot/cow_writer.cpp for available options,
   // as this parameter is ultimated forwarded to libsnapshot's CowWriter
   optional string vabc_compression_param = 4;
+
+  // COW version used by VABC. The represents the major version in the COW
+  // header
+  optional uint32 cow_version = 5;
 }
 
 // Definition has been duplicated from