Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa265b63 authored by Steve Fung's avatar Steve Fung
Browse files

crash_reporter: Report the bdk_version

Add the bdk_version to the crash report.

Bug: 24579018
Change-Id: I00ad1079ee3aacc5d0456f80d83f42c4d28045df
parent 2fb90dc8
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -292,7 +292,7 @@ send_crash() {
  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 @@ send_crash() {
  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 @@ send_crash() {
    --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}" \
+12 −0
Original line number Diff line number Diff line
@@ -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 @@ const char kVersionProperty[] = "ro.build.id";
// 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 @@ UserCollector::ErrorType UserCollector::ConvertAndEnqueueCrash(
  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) {