metricsd: Use system properties to store build time metadata.
Instead of using /etc/lsb-release to store the version, channel and
build_target_id, use the Android system properties.
BUG: 22879642
Change-Id: Ic79e74bd14bf8e2c55549c08963a66700b49b544
diff --git a/metricsd/metrics_daemon.cc b/metricsd/metrics_daemon.cc
index 069f68e..5855cee 100644
--- a/metricsd/metrics_daemon.cc
+++ b/metricsd/metrics_daemon.cc
@@ -32,7 +32,7 @@
#include <base/strings/string_split.h>
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
-#include <base/sys_info.h>
+#include <cutils/properties.h>
#include <dbus/dbus.h>
#include <dbus/message.h>
@@ -209,10 +209,13 @@
if (version_hash_is_cached)
return cached_version_hash;
version_hash_is_cached = true;
- std::string version = metrics::kDefaultVersion;
+
+ char version[PROPERTY_VALUE_MAX];
// The version might not be set for development devices. In this case, use the
// zero version.
- base::SysInfo::GetLsbReleaseValue("BRILLO_VERSION", &version);
+ property_get(metrics::kProductVersionProperty, version,
+ metrics::kDefaultVersion);
+
cached_version_hash = base::Hash(version);
if (testing_) {
cached_version_hash = 42; // return any plausible value for the hash