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

Commit e2933029 authored by Palash Ahuja's avatar Palash Ahuja Committed by Gerrit Code Review
Browse files

Merge changes I3ab22e71,I581271ae into main

* changes:
  BluetoothMetrics: Map HCI Error Code to State in Bluetooth Event
  BluetoothMetrics: Log Remote Name Request Completion
parents 948f1966 b162d98b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -41,6 +41,11 @@ State MapErrorCodeToState(ErrorCode reason) {
      return State::CONNECTION_ACCEPT_TIMEOUT;
    case ErrorCode::TRANSACTION_RESPONSE_TIMEOUT:
      return State::TRANSACTION_RESPONSE_TIMEOUT;
    case ErrorCode::AUTHENTICATION_FAILURE:
      return State::AUTH_FAILURE;
    case ErrorCode::REMOTE_DEVICE_TERMINATED_CONNECTION_LOW_RESOURCES:
    case ErrorCode::REMOTE_DEVICE_TERMINATED_CONNECTION_POWER_OFF:
      return State::REMOTE_USER_TERMINATED_CONNECTION;
    case ErrorCode::CONNECTION_ALREADY_EXISTS:
      return State::ALREADY_CONNECTED;
    case ErrorCode::REPEATED_ATTEMPTS:
@@ -95,6 +100,13 @@ void LogAclCompletionEvent(const hci::Address& address, ErrorCode reason,
                                         MapErrorCodeToState(reason));
}

void LogRemoteNameRequestCompletion(const RawAddress& raw_address, tHCI_STATUS hci_status) {
  hci::Address address = bluetooth::ToGdAddress(raw_address);
  bluetooth::os::LogMetricBluetoothEvent(
          address, EventType::REMOTE_NAME_REQUEST,
          MapHCIStatusToState(hci_status));
}

void LogAclAfterRemoteNameRequest(const RawAddress& raw_address, tBTM_STATUS status) {
  hci::Address address = bluetooth::ToGdAddress(raw_address);

+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ namespace metrics {
void LogAclCompletionEvent(const hci::Address& address, hci::ErrorCode reason,
                           bool is_locally_initiated);

void LogRemoteNameRequestCompletion(const RawAddress& raw_address, tHCI_STATUS hci_status);

void LogAclAfterRemoteNameRequest(const RawAddress& raw_address, tBTM_STATUS status);

+2 −1
Original line number Diff line number Diff line
@@ -2170,7 +2170,6 @@ tBTM_SEC_DEV_REC* btm_rnr_add_name_to_security_record(const RawAddress* p_bd_add
            "name:{} classic_link:{}",
            tBTM_SEC_CB::btm_pair_state_descr(btm_sec_cb.pairing_state),
            reinterpret_cast<char const*>(p_bd_name), p_dev_rec->sec_rec.classic_link);

    bd_name_copy(p_dev_rec->sec_bd_name, p_bd_name);
    p_dev_rec->sec_rec.sec_flags |= BTM_SEC_NAME_KNOWN;
    log::verbose("setting BTM_SEC_NAME_KNOWN sec_flags:0x{:x}", p_dev_rec->sec_rec.sec_flags);
@@ -2187,6 +2186,8 @@ tBTM_SEC_DEV_REC* btm_rnr_add_name_to_security_record(const RawAddress* p_bd_add
    p_dev_rec->sec_bd_name[0] = 0;
  }

  bluetooth::metrics::LogRemoteNameRequestCompletion(bd_addr, hci_status);

  /* Notify all clients waiting for name to be resolved */
  call_registered_rmt_name_callbacks(&bd_addr, p_dev_rec->dev_class, p_dev_rec->sec_bd_name,
                                     hci_status);