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

Commit 958483f5 authored by Archie Pusaka's avatar Archie Pusaka Committed by Gerrit Code Review
Browse files

Merge changes Ib012068f,I564b0f7b,I41f5b133

* changes:
  floss: Send ChipsetInfo metrics
  floss: Send ACL connection state metrics
  floss: plumbing (dis)connection direction to btif
parents 0a8f937c b912391e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -368,7 +368,8 @@ static void le_address_associate_callback(RawAddress* main_bd_addr,
static void acl_state_changed_callback(bt_status_t status, RawAddress* bd_addr,
                                       bt_acl_state_t state,
                                       int transport_link_type,
                                       bt_hci_error_code_t hci_reason) {
                                       bt_hci_error_code_t hci_reason,
                                       bt_conn_direction_t direction) {
  if (!bd_addr) {
    ALOGE("Address is null in %s", __func__);
    return;
+2 −1
Original line number Diff line number Diff line
@@ -224,7 +224,8 @@ void invoke_le_address_associate_cb(RawAddress main_bd_addr,
                                    RawAddress secondary_bd_addr);
void invoke_acl_state_changed_cb(bt_status_t status, RawAddress bd_addr,
                                 bt_acl_state_t state, int transport_link_type,
                                 bt_hci_error_code_t hci_reason);
                                 bt_hci_error_code_t hci_reason,
                                 bt_conn_direction_t direction);
void invoke_thread_evt_cb(bt_cb_thread_evt event);
void invoke_le_test_mode_cb(bt_status_t status, uint16_t count);
void invoke_energy_info_cb(bt_activity_energy_info energy_info,
+6 −4
Original line number Diff line number Diff line
@@ -990,16 +990,18 @@ void invoke_le_address_associate_cb(RawAddress main_bd_addr,
}
void invoke_acl_state_changed_cb(bt_status_t status, RawAddress bd_addr,
                                 bt_acl_state_t state, int transport_link_type,
                                 bt_hci_error_code_t hci_reason) {
                                 bt_hci_error_code_t hci_reason,
                                 bt_conn_direction_t direction) {
  do_in_jni_thread(
      FROM_HERE,
      base::BindOnce(
          [](bt_status_t status, RawAddress bd_addr, bt_acl_state_t state,
             int transport_link_type, bt_hci_error_code_t hci_reason) {
             int transport_link_type, bt_hci_error_code_t hci_reason,
             bt_conn_direction_t direction) {
            HAL_CBACK(bt_hal_cbacks, acl_state_changed_cb, status, &bd_addr,
                      state, transport_link_type, hci_reason);
                      state, transport_link_type, hci_reason, direction);
          },
          status, bd_addr, state, transport_link_type, hci_reason));
          status, bd_addr, state, transport_link_type, hci_reason, direction));
}

void invoke_thread_evt_cb(bt_cb_thread_evt event) {
+27 −5
Original line number Diff line number Diff line
@@ -1825,26 +1825,48 @@ static void btif_dm_upstreams_evt(uint16_t event, char* p_param) {

      invoke_acl_state_changed_cb(
          BT_STATUS_SUCCESS, bd_addr, BT_ACL_STATE_CONNECTED,
          (int)p_data->link_up.transport_link_type, HCI_SUCCESS);
          (int)p_data->link_up.transport_link_type, HCI_SUCCESS,
          btm_is_acl_locally_initiated()
              ? bt_conn_direction_t::BT_CONN_DIRECTION_OUTGOING
              : bt_conn_direction_t::BT_CONN_DIRECTION_INCOMING);
      break;

    case BTA_DM_LINK_UP_FAILED_EVT:
      invoke_acl_state_changed_cb(
          BT_STATUS_FAIL, p_data->link_up_failed.bd_addr,
          BT_ACL_STATE_DISCONNECTED, p_data->link_up_failed.transport_link_type,
          p_data->link_up_failed.status);
          p_data->link_up_failed.status,
          btm_is_acl_locally_initiated()
              ? bt_conn_direction_t::BT_CONN_DIRECTION_OUTGOING
              : bt_conn_direction_t::BT_CONN_DIRECTION_INCOMING);
      break;

    case BTA_DM_LINK_DOWN_EVT:
    case BTA_DM_LINK_DOWN_EVT: {
      bd_addr = p_data->link_down.bd_addr;
      btm_set_bond_type_dev(p_data->link_down.bd_addr,
                            tBTM_SEC_DEV_REC::BOND_TYPE_UNKNOWN);
      btif_av_acl_disconnected(bd_addr);

      bt_conn_direction_t direction;
      switch (btm_get_acl_disc_reason_code()) {
        case HCI_ERR_PEER_USER:
        case HCI_ERR_REMOTE_LOW_RESOURCE:
        case HCI_ERR_REMOTE_POWER_OFF:
          direction = bt_conn_direction_t::BT_CONN_DIRECTION_INCOMING;
          break;
        case HCI_ERR_CONN_CAUSE_LOCAL_HOST:
        case HCI_ERR_HOST_REJECT_SECURITY:
          direction = bt_conn_direction_t::BT_CONN_DIRECTION_OUTGOING;
          break;
        default:
          direction = bt_conn_direction_t::BT_CONN_DIRECTION_UNKNOWN;
      }

      invoke_acl_state_changed_cb(
          BT_STATUS_SUCCESS, bd_addr, BT_ACL_STATE_DISCONNECTED,
          (int)p_data->link_down.transport_link_type,
          static_cast<bt_hci_error_code_t>(btm_get_acl_disc_reason_code()));
          static_cast<bt_hci_error_code_t>(btm_get_acl_disc_reason_code()),
          direction);
      LOG_DEBUG(
          "Sent BT_ACL_STATE_DISCONNECTED upward as ACL link down event "
          "device:%s reason:%s",
@@ -1852,7 +1874,7 @@ static void btif_dm_upstreams_evt(uint16_t event, char* p_param) {
          hci_reason_code_text(
              static_cast<tHCI_REASON>(btm_get_acl_disc_reason_code()))
              .c_str());
      break;
    } break;

    case BTA_DM_BLE_KEY_EVT:
      BTIF_TRACE_DEBUG("BTA_DM_BLE_KEY_EVT key_type=0x%02x ",
+2 −1
Original line number Diff line number Diff line
@@ -69,7 +69,8 @@ void le_address_associate_callback(RawAddress* main_bd_addr,
                                   RawAddress* secondary_bd_addr) {}
void acl_state_changed_callback(bt_status_t status, RawAddress* remote_bd_addr,
                                bt_acl_state_t state, int transport_link_type,
                                bt_hci_error_code_t hci_reason) {}
                                bt_hci_error_code_t hci_reason,
                                bt_conn_direction_t direction) {}
void link_quality_report_callback(uint64_t timestamp, int report_id, int rssi,
                                  int snr, int retransmission_count,
                                  int packets_not_receive_count,
Loading