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

Commit 4dd41867 authored by Weichin Weng's avatar Weichin Weng Committed by Gerrit Code Review
Browse files

Merge "GD: Add LogBluetoothHalCrashReason"

parents 13b5da64 7ea279f5
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -278,13 +278,15 @@ struct HciLayer::impl {
  }

  void handle_root_inflammation(uint8_t vse_error_reason) {
    LOG_ERROR("Received a Root Inflammation Event vendor reason 0x%02hhx, scheduling an abort",
              vse_error_reason);
    bluetooth::os::LogMetricBluetoothHalCrashReason(Address::kEmpty, 0, vse_error_reason);
    // Add Logging for crash reason
    if (hci_timeout_alarm_ != nullptr) {
      hci_timeout_alarm_->Cancel();
      delete hci_timeout_alarm_;
      hci_timeout_alarm_ = nullptr;
    }
    LOG_ERROR("Received a Root Inflammation Event, scheduling an abort");
    if (hci_abort_alarm_ == nullptr) {
      hci_abort_alarm_ = new Alarm(module_.GetHandler());
      hci_abort_alarm_->Schedule(BindOnce(&abort_after_root_inflammation, vse_error_reason), kHciTimeoutRestartMs);
+20 −0
Original line number Diff line number Diff line
@@ -406,5 +406,25 @@ void LogMetricManufacturerInfo(
  }
}

void LogMetricBluetoothHalCrashReason(
    const Address& address,
    uint32_t error_code,
    uint32_t vendor_error_code) {
  int ret = android::util::stats_write(
      android::util::BLUETOOTH_HAL_CRASH_REASON_REPORTED,
      0 /* metric_id */,
      byteField,
      error_code,
      vendor_error_code);
  if (ret < 0) {
    LOG_WARN(
        "Failed for %s, error_code %s, vendor_error_code %s, error %d",
        address.ToString().c_str(),
        common::ToHexString(error_code).c_str(),
        common::ToHexString(vendor_error_code).c_str(),
        ret);
  }
}

}  // namespace os
}  // namespace bluetooth
+4 −0
Original line number Diff line number Diff line
@@ -98,5 +98,9 @@ void LogMetricSmpPairingEvent(
    const Address& address, uint8_t smp_cmd, android::bluetooth::DirectionEnum direction, uint8_t smp_fail_reason) {}

void LogMetricA2dpPlaybackEvent(const Address& address, int playback_state, int audio_coding_mode) {}

void LogMetricBluetoothHalCrashReason(
    const Address& address, uint32_t error_code, uint32_t vendor_error_code) {}

}  // namespace os
}  // namespace bluetooth
+4 −0
Original line number Diff line number Diff line
@@ -98,5 +98,9 @@ void LogMetricSmpPairingEvent(
    const Address& address, uint8_t smp_cmd, android::bluetooth::DirectionEnum direction, uint8_t smp_fail_reason) {}

void LogMetricA2dpPlaybackEvent(const Address& address, int playback_state, int audio_coding_mode) {}

void LogMetricBluetoothHalCrashReason(
    const Address& address, uint32_t error_code, uint32_t vendor_error_code) {}

}  // namespace os
}  // namespace bluetooth
+12 −0
Original line number Diff line number Diff line
@@ -251,6 +251,18 @@ void LogMetricManufacturerInfo(
    const std::string& model,
    const std::string& hardware_version,
    const std::string& software_version);

/**
 * Logs when received Bluetooth HAL crash reason report.
 *
 * @param address current connected address.
 * @param error_code the crash reason from bluetooth hal
 * @param vendor_error_code the vendor crash reason from bluetooth firmware
 */
void LogMetricBluetoothHalCrashReason(
    const hci::Address& address,
    uint32_t error_code,
    uint32_t vendor_error_code);
}  // namespace os

}  // namespace bluetooth