Add support for reporting product components to Omaha.
Parse the product_components file from os-release.d and report
them in separate xml attributes.
Bug: 67872115
Test: check omaha request
Change-Id: I82cc3ef30b0cc9bab33f8e7eb939856a4740b9e3
(cherry picked from commit a025114f8df6509f80e60b19b5eca615610104b1)
diff --git a/image_properties_android.cc b/image_properties_android.cc
index 886a6b6..608bca7 100644
--- a/image_properties_android.cc
+++ b/image_properties_android.cc
@@ -27,6 +27,7 @@
#include "update_engine/common/constants.h"
#include "update_engine/common/platform_constants.h"
#include "update_engine/common/prefs_interface.h"
+#include "update_engine/common/utils.h"
#include "update_engine/system_state.h"
using android::base::GetProperty;
@@ -42,6 +43,10 @@
const char kSystemId[] = "system_id";
const char kSystemVersion[] = "system_version";
+// The path to the product_components file which stores the version of each
+// components in OEM partition.
+const char kProductComponentsPath[] = "/oem/os-release.d/product_components";
+
// Prefs used to store the target channel and powerwash settings.
const char kPrefsImgPropChannelName[] = "img-prop-channel-name";
const char kPrefsImgPropPowerwashAllowed[] = "img-prop-powerwash-allowed";
@@ -97,6 +102,8 @@
result.version = GetStringWithDefault(osrelease, kProductVersion, "0.0.0.0");
result.system_version =
GetStringWithDefault(osrelease, kSystemVersion, "0.0.0.0");
+ // Can't read it with OsReleaseReader because it has multiple lines.
+ utils::ReadFile(kProductComponentsPath, &result.product_components);
result.board = GetProperty(kPropProductName, "brillo");
result.build_fingerprint = GetProperty(kPropBuildFingerprint, "none");