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

Commit 1aaabb4b authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "BluetoothMetrics: Log ACL Disconnection" into main

parents 2818d301 a2739027
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ State MapErrorCodeToState(ErrorCode reason) {
      return State::TRANSACTION_RESPONSE_TIMEOUT;
    case ErrorCode::AUTHENTICATION_FAILURE:
      return State::AUTH_FAILURE;
    case ErrorCode::REMOTE_USER_TERMINATED_CONNECTION:
    case ErrorCode::REMOTE_DEVICE_TERMINATED_CONNECTION_LOW_RESOURCES:
    case ErrorCode::REMOTE_DEVICE_TERMINATED_CONNECTION_POWER_OFF:
      return State::REMOTE_USER_TERMINATED_CONNECTION;
@@ -112,6 +113,15 @@ void LogRemoteNameRequestCompletion(const RawAddress& raw_address, tHCI_STATUS h
          MapHCIStatusToState(hci_status));
}

void LogAclDisconnectionEvent(const hci::Address& address, ErrorCode reason,
                              bool is_locally_initiated) {
  bluetooth::os::LogMetricBluetoothEvent(address,
                                         is_locally_initiated
                                                 ? EventType::ACL_DISCONNECTION_INITIATOR
                                                 : EventType::ACL_DISCONNECTION_RESPONDER,
                                         MapErrorCodeToState(reason));
}

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

+3 −0
Original line number Diff line number Diff line
@@ -32,6 +32,9 @@ void LogAclCompletionEvent(const hci::Address& address, hci::ErrorCode reason,

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

void LogAclDisconnectionEvent(const hci::Address& address, hci::ErrorCode reason,
                              bool is_locally_initiated);

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

void LogUserConfirmationRequestResponse(const hci::Address& address, bool positive);
+2 −0
Original line number Diff line number Diff line
@@ -1397,6 +1397,8 @@ void shim::Acl::OnClassicLinkDisconnected(HciHandle handle, hci::ErrorCode reaso

  TeardownTime teardown_time = std::chrono::system_clock::now();

  bluetooth::metrics::LogAclDisconnectionEvent(remote_address, reason, is_locally_initiated);

  pimpl_->handle_to_classic_connection_map_.erase(handle);
  TRY_POSTING_ON_MAIN(acl_interface_.connection.classic.on_disconnected,
                      ToLegacyHciErrorCode(hci::ErrorCode::SUCCESS), handle,