system/bt
Revisão | 2f320d60bcc8ab32971eed163df3fca79c792fd1 (tree) |
---|---|
Hora | 2020-02-12 10:26:40 |
Autor | android-build-team Robot <android-build-team-robot@goog...> |
Commiter | android-build-team Robot |
Merge cherrypicks of [10301183, 10301340, 10301110, 10299537, 10300908, 10301450, 10300619, 10301451, 10301654, 10301341, 10301342, 10301343, 10301344, 10301508, 10301184, 10301185, 10301309, 10301290, 10301310, 10301345, 10301346, 10301464, 10301291, 10300931, 10301382, 10301383, 10301465, 10301384, 10301385, 10301408, 10301386, 10299538, 10301387, 10301388, 10301389, 10301390, 10301391, 10301292, 10301392, 10301393, 10301694, 10301695, 10301489, 10299807, 10299808, 10299809, 10300620, 10301491, 10301111, 10301348] into qt-qpr2-release
Change-Id: I0cfb719c6af78bb1bb752f29e2950fcf20e1ad24
@@ -362,6 +362,8 @@ tBTA_JV_STATUS bta_jv_free_l2c_cb(tBTA_JV_L2C_CB* p_cb) { | ||
362 | 362 | p_cb->cong = false; |
363 | 363 | bta_jv_free_sec_id(&p_cb->sec_id); |
364 | 364 | p_cb->p_cback = NULL; |
365 | + p_cb->handle = 0; | |
366 | + p_cb->l2cap_socket_id = 0; | |
365 | 367 | return status; |
366 | 368 | } |
367 | 369 |
@@ -1121,7 +1123,7 @@ void bta_jv_l2cap_start_server(int32_t type, tBTA_SEC sec_mask, | ||
1121 | 1123 | /* stops an L2CAP server */ |
1122 | 1124 | void bta_jv_l2cap_stop_server(uint16_t local_psm, uint32_t l2cap_socket_id) { |
1123 | 1125 | for (int i = 0; i < BTA_JV_MAX_L2C_CONN; i++) { |
1124 | - if (bta_jv_cb.l2c_cb[i].psm == local_psm) { | |
1126 | + if (bta_jv_cb.l2c_cb[i].l2cap_socket_id == l2cap_socket_id) { | |
1125 | 1127 | tBTA_JV_L2C_CB* p_cb = &bta_jv_cb.l2c_cb[i]; |
1126 | 1128 | tBTA_JV_L2CAP_CBACK* p_cback = p_cb->p_cback; |
1127 | 1129 | tBTA_JV_L2CAP_CLOSE evt_data; |
@@ -97,6 +97,7 @@ static void btsock_l2cap_server_listen(l2cap_socket* sock); | ||
97 | 97 | static std::mutex state_lock; |
98 | 98 | |
99 | 99 | l2cap_socket* socks = NULL; |
100 | +static uint32_t last_sock_id = 0; | |
100 | 101 | static uid_set_t* uid_set = NULL; |
101 | 102 | static int pth = -1; |
102 | 103 |
@@ -254,6 +255,11 @@ static void btsock_l2cap_free_l(l2cap_socket* sock) { | ||
254 | 255 | } |
255 | 256 | if ((sock->channel >= 0) && (sock->server)) { |
256 | 257 | BTA_JvFreeChannel(sock->channel, BTA_JV_CONN_TYPE_L2CAP_LE); |
258 | + if (!sock->fixed_chan) { | |
259 | + VLOG(2) << __func__ << ": stopping L2CAP LE COC server channel " | |
260 | + << sock->channel; | |
261 | + BTA_JvL2capStopServer(sock->channel, sock->id); | |
262 | + } | |
257 | 263 | } |
258 | 264 | } else { |
259 | 265 | // Only call if we are non server connections |
@@ -322,7 +328,7 @@ static l2cap_socket* btsock_l2cap_alloc_l(const char* name, | ||
322 | 328 | sock->next = socks; |
323 | 329 | sock->prev = NULL; |
324 | 330 | if (socks) socks->prev = sock; |
325 | - sock->id = (socks ? socks->id : 0) + 1; | |
331 | + sock->id = last_sock_id + 1; | |
326 | 332 | sock->tx_bytes = 0; |
327 | 333 | sock->rx_bytes = 0; |
328 | 334 | socks = sock; |
@@ -340,6 +346,7 @@ static l2cap_socket* btsock_l2cap_alloc_l(const char* name, | ||
340 | 346 | if (!++sock->id) /* no zero IDs allowed */ |
341 | 347 | sock->id++; |
342 | 348 | } |
349 | + last_sock_id = sock->id; | |
343 | 350 | DVLOG(2) << __func__ << " SOCK_LIST: alloc id:" << sock->id; |
344 | 351 | return sock; |
345 | 352 |