crash_reporter: Report the bdk_version
Add the bdk_version to the crash report.
Bug: 24579018
Change-Id: I00ad1079ee3aacc5d0456f80d83f42c4d28045df
diff --git a/crash_reporter/crash_sender b/crash_reporter/crash_sender
index 8a422dd..e38d410 100755
--- a/crash_reporter/crash_sender
+++ b/crash_reporter/crash_sender
@@ -292,7 +292,7 @@
local kind="$(get_kind "${meta_path}")"
local exec_name="$(get_key_value "${meta_path}" "exec_name")"
local url="$(getprop crash_reporter.server)"
- local brillo_version="$(get_key_value "${meta_path}" "ver")"
+ local bdk_version="$(get_key_value "${meta_path}" "bdk_version")"
local hwclass="$(get_hardware_class)"
local write_payload_size="$(get_key_value "${meta_path}" "payload_size")"
local log="$(get_key_value "${meta_path}" "log")"
@@ -370,12 +370,12 @@
fi
# If ID or VERSION_ID is undefined, we use the default product name
- # and CHROMEOS_RELEASE_VERSION from /etc/lsb-release.
+ # and bdk_version from /etc/os-release.d.
if [ "${product}" = "undefined" ]; then
product="${BRILLO_PRODUCT}"
fi
if [ "${version}" = "undefined" ]; then
- version="${brillo_version}"
+ version="${bdk_version}"
fi
local image_type
@@ -460,6 +460,7 @@
--capath "${RESTRICTED_CERTIFICATES_PATH}" --ciphers HIGH \
-F "prod=${product}" \
-F "ver=${version}" \
+ -F "bdk_version=${bdk_version}" \
-F "hwclass=${hwclass}" \
-F "exec_name=${exec_name}" \
-F "model_manifest_id=${model_manifest_id}" \
diff --git a/crash_reporter/user_collector.cc b/crash_reporter/user_collector.cc
index c4f02af..c2e0732 100644
--- a/crash_reporter/user_collector.cc
+++ b/crash_reporter/user_collector.cc
@@ -37,6 +37,7 @@
#include <base/strings/string_split.h>
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
+#include "chromeos/osrelease_reader.h"
#include <chromeos/process.h>
#include <chromeos/syslog_logging.h>
#include <cutils/properties.h>
@@ -64,6 +65,8 @@
// The property containing the product id.
const char kProductIDProperty[] = "ro.product.product_id";
+static const char kBdkVersionKey[] = "bdk_version";
+
using base::FilePath;
using base::StringPrintf;
@@ -511,6 +514,15 @@
property_get(kProductIDProperty, value, "undefined");
AddCrashMetaUploadData("prod", value);
+ chromeos::OsReleaseReader reader;
+ reader.Load();
+ std::string bdk_version = "undefined";
+ if (!reader.GetString(kBdkVersionKey, &bdk_version)) {
+ LOG(ERROR) << "Could not read " << kBdkVersionKey
+ << " from /etc/os-release.d/";
+ }
+ AddCrashMetaData(kBdkVersionKey, bdk_version);
+
ErrorType error_type =
ConvertCoreToMinidump(pid, container_dir, core_path, minidump_path);
if (error_type != kErrorNone) {