Emit XOR ops at OTA generation time
1. Add a new merge operation type: COW_XOR
2. When running bsdiff, extract similar blocks and record them in
annotated operations
3. During merge sequence generation, include COW_XOR ops as well
Test: treehugger
Bug: 177104308
Change-Id: If894736859b572e761e83be5a9498235caa68866
diff --git a/payload_generator/annotated_operation.h b/payload_generator/annotated_operation.h
index 653bab0..c57f249 100644
--- a/payload_generator/annotated_operation.h
+++ b/payload_generator/annotated_operation.h
@@ -19,6 +19,7 @@
#include <ostream> // NOLINT(readability/streams)
#include <string>
+#include <vector>
#include <brillo/secure_blob.h>
@@ -35,6 +36,11 @@
// The InstallOperation, as defined by the protobuf.
InstallOperation op;
+ // Array of blocks which should be converted to XOR during OTA install.
+ // All elements in this array should have |merge_op.type() == COW_XOR|.
+ // This information is typically derived from BSDIFF patch data.
+ std::vector<CowMergeOperation> xor_ops;
+
// Writes |blob| to the end of |blob_file|. It sets the data_offset and
// data_length in AnnotatedOperation to match the offset and size of |blob|
// in |blob_file|.