Loading system/btif/src/btif_sock.cc +2 −14 Original line number Diff line number Diff line Loading @@ -269,7 +269,6 @@ static bt_status_t btsock_listen(btsock_type_t type, const char* service_name, *sock_fd = INVALID_FD; bt_status_t status = BT_STATUS_FAIL; int original_channel = channel; log_socket_connection_state(RawAddress::kEmpty, 0, type, android::bluetooth::SocketConnectionstateEnum:: Loading @@ -286,19 +285,8 @@ static bt_status_t btsock_listen(btsock_type_t type, const char* service_name, btsock_l2cap_listen(service_name, channel, sock_fd, flags, app_uid); break; case BTSOCK_L2CAP_LE: if (flags & BTSOCK_FLAG_NO_SDP) { /* Set channel to zero so that it will be assigned */ channel = 0; } else if (channel <= 0) { log::error("type BTSOCK_L2CAP_LE: invalid channel={}", channel); break; } flags |= BTSOCK_FLAG_LE_COC; log::info( "type=BTSOCK_L2CAP_LE, channel=0x{:x}, original=0x{:x}, flags=0x{:x}", channel, original_channel, flags); status = btsock_l2cap_listen(service_name, channel, sock_fd, flags, app_uid); status = btsock_l2cap_listen(service_name, channel, sock_fd, flags | BTSOCK_FLAG_LE_COC, app_uid); break; case BTSOCK_SCO: status = btsock_sco_listen(sock_fd, flags); Loading system/btif/src/btif_sock_l2cap.cc +12 −2 Original line number Diff line number Diff line Loading @@ -786,15 +786,25 @@ static bt_status_t btsock_l2cap_listen_or_connect(const char* name, int channel, int* sock_fd, int flags, char listen, int app_uid) { if (!is_inited()) return BT_STATUS_NOT_READY; bool is_le_coc = (flags & BTSOCK_FLAG_LE_COC) != 0; if (is_le_coc && listen) { if (flags & BTSOCK_FLAG_NO_SDP) { /* For LE COC server; set channel to zero so that it will be assigned */ channel = 0; } else if (channel <= 0) { log::error("type BTSOCK_L2CAP_LE: invalid channel={}", channel); return BT_STATUS_FAIL; } } if (!sock_fd) { log::info("Invalid socket descriptor"); return BT_STATUS_PARM_INVALID; } if (!is_inited()) return BT_STATUS_NOT_READY; // TODO: This is kind of bad to lock here, but it is needed for the current // design. std::unique_lock<std::mutex> lock(state_lock); Loading Loading
system/btif/src/btif_sock.cc +2 −14 Original line number Diff line number Diff line Loading @@ -269,7 +269,6 @@ static bt_status_t btsock_listen(btsock_type_t type, const char* service_name, *sock_fd = INVALID_FD; bt_status_t status = BT_STATUS_FAIL; int original_channel = channel; log_socket_connection_state(RawAddress::kEmpty, 0, type, android::bluetooth::SocketConnectionstateEnum:: Loading @@ -286,19 +285,8 @@ static bt_status_t btsock_listen(btsock_type_t type, const char* service_name, btsock_l2cap_listen(service_name, channel, sock_fd, flags, app_uid); break; case BTSOCK_L2CAP_LE: if (flags & BTSOCK_FLAG_NO_SDP) { /* Set channel to zero so that it will be assigned */ channel = 0; } else if (channel <= 0) { log::error("type BTSOCK_L2CAP_LE: invalid channel={}", channel); break; } flags |= BTSOCK_FLAG_LE_COC; log::info( "type=BTSOCK_L2CAP_LE, channel=0x{:x}, original=0x{:x}, flags=0x{:x}", channel, original_channel, flags); status = btsock_l2cap_listen(service_name, channel, sock_fd, flags, app_uid); status = btsock_l2cap_listen(service_name, channel, sock_fd, flags | BTSOCK_FLAG_LE_COC, app_uid); break; case BTSOCK_SCO: status = btsock_sco_listen(sock_fd, flags); Loading
system/btif/src/btif_sock_l2cap.cc +12 −2 Original line number Diff line number Diff line Loading @@ -786,15 +786,25 @@ static bt_status_t btsock_l2cap_listen_or_connect(const char* name, int channel, int* sock_fd, int flags, char listen, int app_uid) { if (!is_inited()) return BT_STATUS_NOT_READY; bool is_le_coc = (flags & BTSOCK_FLAG_LE_COC) != 0; if (is_le_coc && listen) { if (flags & BTSOCK_FLAG_NO_SDP) { /* For LE COC server; set channel to zero so that it will be assigned */ channel = 0; } else if (channel <= 0) { log::error("type BTSOCK_L2CAP_LE: invalid channel={}", channel); return BT_STATUS_FAIL; } } if (!sock_fd) { log::info("Invalid socket descriptor"); return BT_STATUS_PARM_INVALID; } if (!is_inited()) return BT_STATUS_NOT_READY; // TODO: This is kind of bad to lock here, but it is needed for the current // design. std::unique_lock<std::mutex> lock(state_lock); Loading