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

Commit 0a8f937c authored by Archie Pusaka's avatar Archie Pusaka Committed by Gerrit Code Review
Browse files

Merge "floss: Send event on connection failure"

parents 2f74567a aa88fe3f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -929,6 +929,11 @@ final class RemoteDevices {
    })
    void aclStateChangeCallback(int status, byte[] address, int newState,
                                int transportLinkType, int hciReason) {
        if (status != AbstractionLayer.BT_STATUS_SUCCESS) {
            debugLog("aclStateChangeCallback status is " + status + ", skipping");
            return;
        }

        BluetoothDevice device = getDevice(address);

        if (device == null) {
+17 −0
Original line number Diff line number Diff line
@@ -2506,6 +2506,23 @@ void BTA_dm_acl_up(const RawAddress bd_addr, tBT_TRANSPORT transport) {
  do_in_main_thread(FROM_HERE, base::Bind(bta_dm_acl_up, bd_addr, transport));
}

static void bta_dm_acl_up_failed(const RawAddress bd_addr,
                                 tBT_TRANSPORT transport, tHCI_STATUS status) {
  if (bta_dm_cb.p_sec_cback) {
    tBTA_DM_SEC conn = {};
    conn.link_up_failed.bd_addr = bd_addr;
    conn.link_up_failed.transport_link_type = transport;
    conn.link_up_failed.status = status;
    bta_dm_cb.p_sec_cback(BTA_DM_LINK_UP_FAILED_EVT, &conn);
  }
}

void BTA_dm_acl_up_failed(const RawAddress bd_addr, tBT_TRANSPORT transport,
                          tHCI_STATUS status) {
  do_in_main_thread(
      FROM_HERE, base::Bind(bta_dm_acl_up_failed, bd_addr, transport, status));
}

static void bta_dm_acl_down(const RawAddress& bd_addr,
                            tBT_TRANSPORT transport) {
  bool issue_unpair_cb = false;
+11 −1
Original line number Diff line number Diff line
@@ -225,6 +225,7 @@ typedef enum : uint8_t {
  BTA_DM_BLE_SC_CR_LOC_OOB_EVT = 31, /* SMP SC Create Local OOB request event */
  BTA_DM_REPORT_BONDING_EVT = 32,    /*handle for pin or key missing*/
  BTA_DM_LE_ADDR_ASSOC_EVT = 33,     /* identity address association event */
  BTA_DM_LINK_UP_FAILED_EVT = 34,    /* Create connection failed event */
} tBTA_DM_SEC_EVT;

/* Structure associated with BTA_DM_PIN_REQ_EVT */
@@ -313,10 +314,18 @@ typedef struct {
  tBT_TRANSPORT transport_link_type;
} tBTA_DM_LINK_UP;

/* Structure associated with BTA_DM_LINK_UP_FAILED_EVT */
typedef struct {
  RawAddress bd_addr; /* BD address peer device. */
  tBT_TRANSPORT transport_link_type;
  tHCI_STATUS status; /* The HCI error code associated with this event */
} tBTA_DM_LINK_UP_FAILED;

/* Structure associated with BTA_DM_LINK_DOWN_EVT */
typedef struct {
  RawAddress bd_addr; /* BD address peer device. */
  tBT_TRANSPORT transport_link_type;
  tHCI_STATUS status;
} tBTA_DM_LINK_DOWN;

#define BTA_AUTH_SP_YES                                                       \
@@ -393,7 +402,8 @@ typedef struct {
typedef union {
  tBTA_DM_PIN_REQ pin_req;        /* PIN request. */
  tBTA_DM_AUTH_CMPL auth_cmpl;    /* Authentication complete indication. */
  tBTA_DM_LINK_UP link_up;        /* ACL connection down event */
  tBTA_DM_LINK_UP link_up;        /* ACL connection up event */
  tBTA_DM_LINK_UP_FAILED link_up_failed; /* ACL connection up failure event */
  tBTA_DM_LINK_DOWN link_down;    /* ACL connection down event */
  tBTA_DM_SP_CFM_REQ cfm_req;     /* user confirm request */
  tBTA_DM_SP_KEY_NOTIF key_notif; /* passkey notification */
+2 −0
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@
#include "types/raw_address.h"

void BTA_dm_acl_up(const RawAddress bd_addr, tBT_TRANSPORT transport);
void BTA_dm_acl_up_failed(const RawAddress bd_addr, tBT_TRANSPORT transport,
                          tHCI_STATUS hci_status);
void BTA_dm_acl_down(const RawAddress bd_addr, tBT_TRANSPORT transport);
void BTA_dm_report_role_change(const RawAddress bd_addr, tHCI_ROLE new_role,
                               tHCI_STATUS hci_status);
+8 −0
Original line number Diff line number Diff line
@@ -1828,11 +1828,19 @@ static void btif_dm_upstreams_evt(uint16_t event, char* p_param) {
          (int)p_data->link_up.transport_link_type, HCI_SUCCESS);
      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);
      break;

    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);

      invoke_acl_state_changed_cb(
          BT_STATUS_SUCCESS, bd_addr, BT_ACL_STATE_DISCONNECTED,
          (int)p_data->link_down.transport_link_type,
Loading