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

Commit 75125a6b authored by Himanshu Rawat's avatar Himanshu Rawat Committed by Android Build Coastguard Worker
Browse files

Reducing Gatt_Connect overloads

Test: mmm packages/modules/Bluetooth
Flag: EXEMPT manual refactor
Bug: 369329192
(cherry picked from https://android-review.googlesource.com/q/commit:4e41e7ca9d06986e95965e28cde90f44fef1f190)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:78d4cfab649aa7521d48ca5387725acb5a44ed43)
Merged-In: I35c7aa3830f5dd6760955a14728440839c3a3c59
Change-Id: I35c7aa3830f5dd6760955a14728440839c3a3c59
parent 8a66f448
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ struct gatt_interface_t {
                [](tGATT_IF client_if, const RawAddress& remote_bda,
                   tBTM_BLE_CONN_TYPE connection_type, bool opportunistic, uint16_t preferred_mtu) {
                  BTA_GATTC_Open(client_if, remote_bda, BLE_ADDR_PUBLIC, connection_type,
                                 BT_TRANSPORT_LE, opportunistic, 1, preferred_mtu);
                                 BT_TRANSPORT_LE, opportunistic, LE_PHY_1M, preferred_mtu);
                },
};

+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ gatt_interface_t default_gatt_interface = {
                          ADDRESS_TO_LOGGABLE_CSTR(remote_bda), client_if, connection_type,
                          (opportunistic) ? 'T' : 'F'));
                  BTA_GATTC_Open(client_if, remote_bda, BLE_ADDR_PUBLIC, connection_type,
                                 BT_TRANSPORT_LE, opportunistic, 1, preferred_mtu);
                                 BT_TRANSPORT_LE, opportunistic, LE_PHY_1M, preferred_mtu);
                },
};

+1 −1
Original line number Diff line number Diff line
@@ -480,7 +480,7 @@ static void bta_gattc_init_bk_conn(const tBTA_GATTC_API_OPEN* p_data, tBTA_GATTC

  /* always call open to hold a connection */
  if (!GATT_Connect(p_data->client_if, p_data->remote_bda, BLE_ADDR_PUBLIC, p_data->connection_type,
                    p_data->transport, false, 1, p_data->preferred_mtu)) {
                    p_data->transport, false, LE_PHY_1M, p_data->preferred_mtu)) {
    log::error("Unable to connect to remote bd_addr={}", p_data->remote_bda);
    bta_gattc_send_open_cback(p_clreg, GATT_ILLEGAL_PARAMETER, p_data->remote_bda,
                              GATT_INVALID_CONN_ID, BT_TRANSPORT_LE, 0);
+2 −17
Original line number Diff line number Diff line
@@ -133,13 +133,6 @@ void BTA_GATTC_AppDeregister(tGATT_IF client_if) {
 *                  opportunistic, and don't impact the disconnection timer
 *
 ******************************************************************************/
void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda,
                    tBTM_BLE_CONN_TYPE connection_type, bool opportunistic) {
  constexpr uint8_t kPhyLe1M = 0x01;  // From the old controller shim.
  uint8_t phy = kPhyLe1M;
  BTA_GATTC_Open(client_if, remote_bda, connection_type, BT_TRANSPORT_LE, opportunistic, phy);
}

void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda, tBLE_ADDR_TYPE addr_type,
                    tBTM_BLE_CONN_TYPE connection_type, tBT_TRANSPORT transport, bool opportunistic,
                    uint8_t initiating_phys, uint16_t preferred_mtu) {
@@ -164,18 +157,10 @@ void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda, tBLE_ADDR_
  post_on_bt_main([data]() { bta_gattc_process_api_open(&data); });
}

void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda, tBLE_ADDR_TYPE addr_type,
                    tBTM_BLE_CONN_TYPE connection_type, tBT_TRANSPORT transport, bool opportunistic,
                    uint8_t initiating_phys) {
  BTA_GATTC_Open(client_if, remote_bda, addr_type, connection_type, transport, opportunistic,
                 initiating_phys, 0);
}

void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda,
                    tBTM_BLE_CONN_TYPE connection_type, tBT_TRANSPORT transport, bool opportunistic,
                    uint8_t initiating_phys) {
                    tBTM_BLE_CONN_TYPE connection_type, bool opportunistic) {
  BTA_GATTC_Open(client_if, remote_bda, BLE_ADDR_PUBLIC, connection_type, BT_TRANSPORT_LE,
                 opportunistic, initiating_phys);
                 opportunistic, LE_PHY_1M, 0);
}

/*******************************************************************************
+1 −1
Original line number Diff line number Diff line
@@ -416,7 +416,7 @@ void bta_gatts_open(tBTA_GATTS_CB* /* p_cb */, tBTA_GATTS_DATA* p_msg) {
    if (com::android::bluetooth::flags::ble_gatt_server_use_address_type_in_connection()) {
      success = GATT_Connect(p_rcb->gatt_if, p_msg->api_open.remote_bda,
                             p_msg->api_open.remote_addr_type, p_msg->api_open.connection_type,
                             p_msg->api_open.transport, false);
                             p_msg->api_open.transport, false, LE_PHY_1M, 0);
    } else {
      success = GATT_Connect(p_rcb->gatt_if, p_msg->api_open.remote_bda,
                             p_msg->api_open.connection_type, p_msg->api_open.transport, false);
Loading