Check if zlib is compatible.
Add a --zlib_fingerprint flag in delta_generator to check if the zlib of
source image is compatible, and only enable IMGDIFF operation if it is.
Test: Added unittest to check /etc/zlib_fingerprint
Bug: 27156099
Change-Id: Ida346a99430c95cdc8a43e1055d6efa08f07ca25
diff --git a/payload_consumer/payload_constants.cc b/payload_consumer/payload_constants.cc
index 3d78e0a..6078a74 100644
--- a/payload_consumer/payload_constants.cc
+++ b/payload_consumer/payload_constants.cc
@@ -33,6 +33,15 @@
const char kDeltaMagic[4] = {'C', 'r', 'A', 'U'};
const char kBspatchPath[] = "bspatch";
+// The zlib in Android and Chrome OS are currently compatible with each other,
+// so they are sharing the same array, but if in the future they are no longer
+// compatible with each other, we coule make the same change on the other one to
+// make them compatible again or use ifdef here.
+const char kCompatibleZlibFingerprint[][65] = {
+ "ea973605ccbbdb24f59f449c5f65861a1a9bc7a4353377aaaa06cb3e0f1cfbd7",
+ "3747fa404cceb00a5ec3606fc779510aaa784d5864ab1d5c28b9e267c40aad5c",
+};
+
const char* InstallOperationTypeName(InstallOperation_Type op_type) {
switch (op_type) {
case InstallOperation::BSDIFF: