Loading system/btif/include/btif_dm.h +2 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,8 @@ bool btif_dm_proc_rmt_oob(const RawAddress& bd_addr, Octet16* p_c, Octet16* p_r); void btif_dm_generate_local_oob_data(tBT_TRANSPORT transport); void btif_check_device_in_inquiry_db(const RawAddress& address); void btif_dm_clear_event_filter(); void btif_dm_clear_event_mask(); Loading system/btif/src/btif_dm.cc +12 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,7 @@ #include <android/sysprop/BluetoothProperties.sysprop.h> #endif bool btif_get_address_type(const RawAddress& bda, tBLE_ADDR_TYPE* p_addr_type); bool btif_get_device_type(const RawAddress& bda, int* p_device_type); using bluetooth::Uuid; Loading Loading @@ -4235,6 +4236,17 @@ bool btif_get_address_type(const RawAddress& bda, tBLE_ADDR_TYPE* p_addr_type) { return true; } void btif_check_device_in_inquiry_db(const RawAddress& address) { tBLE_ADDR_TYPE addr_type = BLE_ADDR_PUBLIC; int device_type = 0; if (btif_get_address_type(address, &addr_type) && btif_get_device_type(address, &device_type) && device_type != BT_DEVICE_TYPE_BREDR) { BTA_DmAddBleDevice(address, addr_type, device_type); } } void btif_dm_clear_event_filter() { BTA_DmClearEventFilter(); } void btif_dm_clear_event_mask() { BTA_DmClearEventMask(); } Loading system/btif/src/btif_sock.cc +3 −22 Original line number Diff line number Diff line Loading @@ -45,9 +45,6 @@ #include "types/bluetooth/uuid.h" #include "types/raw_address.h" bool btif_get_address_type(const RawAddress& bda, tBLE_ADDR_TYPE* p_addr_type); bool btif_get_device_type(const RawAddress& bda, int* p_device_type); using bluetooth::Uuid; using namespace bluetooth; Loading Loading @@ -338,26 +335,10 @@ static bt_status_t btsock_connect(const RawAddress* bd_addr, btsock_type_t type, case BTSOCK_L2CAP: status = btsock_l2cap_connect(bd_addr, channel, sock_fd, flags, app_uid); break; case BTSOCK_L2CAP_LE: { flags |= BTSOCK_FLAG_LE_COC; // Ensure device is in inquiry database tBLE_ADDR_TYPE addr_type = BLE_ADDR_PUBLIC; int device_type = 0; if (btif_get_address_type(*bd_addr, &addr_type) && btif_get_device_type(*bd_addr, &device_type) && device_type != BT_DEVICE_TYPE_BREDR) { BTA_DmAddBleDevice(*bd_addr, addr_type, device_type); } log::info("type=BTSOCK_L2CAP_LE, channel=0x{:x}, flags=0x{:x}", channel, flags); status = btsock_l2cap_connect(bd_addr, channel, sock_fd, flags, app_uid); case BTSOCK_L2CAP_LE: status = btsock_l2cap_connect(bd_addr, channel, sock_fd, (flags | BTSOCK_FLAG_LE_COC), app_uid); break; } case BTSOCK_SCO: status = btsock_sco_connect(bd_addr, sock_fd, flags); break; Loading system/btif/src/btif_sock_l2cap.cc +13 −7 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <cstring> #include "bta/include/bta_jv_api.h" #include "btif/include/btif_dm.h" #include "btif/include/btif_metrics_logging.h" #include "btif/include/btif_sock.h" #include "btif/include/btif_sock_thread.h" Loading Loading @@ -790,7 +791,8 @@ static bt_status_t btsock_l2cap_listen_or_connect(const char* name, bool is_le_coc = (flags & BTSOCK_FLAG_LE_COC) != 0; if (is_le_coc && listen) { if (is_le_coc) { if (listen) { if (flags & BTSOCK_FLAG_NO_SDP) { /* For LE COC server; set channel to zero so that it will be assigned */ channel = 0; Loading @@ -798,6 +800,10 @@ static bt_status_t btsock_l2cap_listen_or_connect(const char* name, log::error("type BTSOCK_L2CAP_LE: invalid channel={}", channel); return BT_STATUS_FAIL; } } else { // Ensure device is in inquiry database during L2CAP CoC connection btif_check_device_in_inquiry_db(*addr); } } if (!sock_fd) { Loading Loading
system/btif/include/btif_dm.h +2 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,8 @@ bool btif_dm_proc_rmt_oob(const RawAddress& bd_addr, Octet16* p_c, Octet16* p_r); void btif_dm_generate_local_oob_data(tBT_TRANSPORT transport); void btif_check_device_in_inquiry_db(const RawAddress& address); void btif_dm_clear_event_filter(); void btif_dm_clear_event_mask(); Loading
system/btif/src/btif_dm.cc +12 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,7 @@ #include <android/sysprop/BluetoothProperties.sysprop.h> #endif bool btif_get_address_type(const RawAddress& bda, tBLE_ADDR_TYPE* p_addr_type); bool btif_get_device_type(const RawAddress& bda, int* p_device_type); using bluetooth::Uuid; Loading Loading @@ -4235,6 +4236,17 @@ bool btif_get_address_type(const RawAddress& bda, tBLE_ADDR_TYPE* p_addr_type) { return true; } void btif_check_device_in_inquiry_db(const RawAddress& address) { tBLE_ADDR_TYPE addr_type = BLE_ADDR_PUBLIC; int device_type = 0; if (btif_get_address_type(address, &addr_type) && btif_get_device_type(address, &device_type) && device_type != BT_DEVICE_TYPE_BREDR) { BTA_DmAddBleDevice(address, addr_type, device_type); } } void btif_dm_clear_event_filter() { BTA_DmClearEventFilter(); } void btif_dm_clear_event_mask() { BTA_DmClearEventMask(); } Loading
system/btif/src/btif_sock.cc +3 −22 Original line number Diff line number Diff line Loading @@ -45,9 +45,6 @@ #include "types/bluetooth/uuid.h" #include "types/raw_address.h" bool btif_get_address_type(const RawAddress& bda, tBLE_ADDR_TYPE* p_addr_type); bool btif_get_device_type(const RawAddress& bda, int* p_device_type); using bluetooth::Uuid; using namespace bluetooth; Loading Loading @@ -338,26 +335,10 @@ static bt_status_t btsock_connect(const RawAddress* bd_addr, btsock_type_t type, case BTSOCK_L2CAP: status = btsock_l2cap_connect(bd_addr, channel, sock_fd, flags, app_uid); break; case BTSOCK_L2CAP_LE: { flags |= BTSOCK_FLAG_LE_COC; // Ensure device is in inquiry database tBLE_ADDR_TYPE addr_type = BLE_ADDR_PUBLIC; int device_type = 0; if (btif_get_address_type(*bd_addr, &addr_type) && btif_get_device_type(*bd_addr, &device_type) && device_type != BT_DEVICE_TYPE_BREDR) { BTA_DmAddBleDevice(*bd_addr, addr_type, device_type); } log::info("type=BTSOCK_L2CAP_LE, channel=0x{:x}, flags=0x{:x}", channel, flags); status = btsock_l2cap_connect(bd_addr, channel, sock_fd, flags, app_uid); case BTSOCK_L2CAP_LE: status = btsock_l2cap_connect(bd_addr, channel, sock_fd, (flags | BTSOCK_FLAG_LE_COC), app_uid); break; } case BTSOCK_SCO: status = btsock_sco_connect(bd_addr, sock_fd, flags); break; Loading
system/btif/src/btif_sock_l2cap.cc +13 −7 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <cstring> #include "bta/include/bta_jv_api.h" #include "btif/include/btif_dm.h" #include "btif/include/btif_metrics_logging.h" #include "btif/include/btif_sock.h" #include "btif/include/btif_sock_thread.h" Loading Loading @@ -790,7 +791,8 @@ static bt_status_t btsock_l2cap_listen_or_connect(const char* name, bool is_le_coc = (flags & BTSOCK_FLAG_LE_COC) != 0; if (is_le_coc && listen) { if (is_le_coc) { if (listen) { if (flags & BTSOCK_FLAG_NO_SDP) { /* For LE COC server; set channel to zero so that it will be assigned */ channel = 0; Loading @@ -798,6 +800,10 @@ static bt_status_t btsock_l2cap_listen_or_connect(const char* name, log::error("type BTSOCK_L2CAP_LE: invalid channel={}", channel); return BT_STATUS_FAIL; } } else { // Ensure device is in inquiry database during L2CAP CoC connection btif_check_device_in_inquiry_db(*addr); } } if (!sock_fd) { Loading