system/bt
Revisão | 63034887a1e053a443007697fd083975a5456516 (tree) |
---|---|
Hora | 2020-02-12 10:19:23 |
Autor | Jack He <siyuanh@goog...> |
Commiter | android-build-team Robot |
L2CAP socket: Stop L2CAP server by ID instead of PSM
* There could be multiple L2CAP socket control blocks with the same PSM
* The unique identifier for a L2CAP socket control block should be the
* Use this ID to track L2CAP socket control block instead of PSM ensure
* Reset GAP handle and L2CAP socket ID to 0 when calling
Test: CtsVerifier
Bug: 147997447
Bug: 144148429
Change-Id: Ideb428bc73aa0b36b8deb20fac280e44c8fe7db1
(cherry picked from commit ad23e6b2f473829b1819918cd3f927d1134c83b3)
(cherry picked from commit 7c901002dcf856c0102425631da3475364ac4129)
@@ -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; |