From 3cb5514c33095e4df88484c7ce6baa6e3aa2114a Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 12 Jan 2021 16:17:27 -0800 Subject: [PATCH] GATT: Set data length directly Since only GATT, hearing aid (hardcoded), JNI (hidden API) can set data length, we just skip L2cap set data length path, and directly send HCI command. Test: cert/run Tag: #gd-refactor Bug: 141555841 Change-Id: Id9dd7f9bdea69b025650ff7a287ba55c0d31db75 --- stack/gatt/gatt_cl.cc | 4 ++-- stack/gatt/gatt_sr.cc | 3 +-- stack/test/gatt/gatt_sr_test.cc | 5 +++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/stack/gatt/gatt_cl.cc b/stack/gatt/gatt_cl.cc index cfe0a5005..96d2ac8a0 100644 --- a/stack/gatt/gatt_cl.cc +++ b/stack/gatt/gatt_cl.cc @@ -1053,8 +1053,8 @@ void gatt_process_mtu_rsp(tGATT_TCB& tcb, tGATT_CLCB* p_clcb, uint16_t len, tcb.payload_size = mtu; } - L2CA_SetLeFixedChannelTxDataLength(tcb.peer_bda, L2CAP_ATT_CID, - tcb.payload_size); + BTM_SetBleDataLength(tcb.peer_bda, tcb.payload_size); + gatt_end_operation(p_clcb, status, NULL); } /******************************************************************************* diff --git a/stack/gatt/gatt_sr.cc b/stack/gatt/gatt_sr.cc index 4a37d9bfa..5b99f1554 100644 --- a/stack/gatt/gatt_sr.cc +++ b/stack/gatt/gatt_sr.cc @@ -814,8 +814,7 @@ static void gatts_process_mtu_req(tGATT_TCB& tcb, uint16_t cid, uint16_t len, LOG(INFO) << "MTU request PDU with MTU size " << +tcb.payload_size; - l2cble_set_fixed_channel_tx_data_length(tcb.peer_bda, L2CAP_ATT_CID, - tcb.payload_size); + BTM_SetBleDataLength(tcb.peer_bda, tcb.payload_size); tGATT_SR_MSG gatt_sr_msg; gatt_sr_msg.mtu = tcb.payload_size; diff --git a/stack/test/gatt/gatt_sr_test.cc b/stack/test/gatt/gatt_sr_test.cc index 06c4cafea..5bd41ed70 100644 --- a/stack/test/gatt/gatt_sr_test.cc +++ b/stack/test/gatt/gatt_sr_test.cc @@ -75,6 +75,11 @@ tGATT_STATUS attp_send_cl_msg(tGATT_TCB& tcb, tGATT_CLCB* p_clcb, tGATT_STATUS attp_send_sr_msg(tGATT_TCB& tcb, uint16_t cid, BT_HDR* p_msg) { return GATT_SUCCESS; } + +tBTM_STATUS BTM_SetBleDataLength(const RawAddress& bd_addr, uint16_t length) { + return BTM_SUCCESS; +} + uint8_t btm_ble_read_sec_key_size(const RawAddress& bd_addr) { return 0; } bool BTM_GetSecurityFlagsByTransport(const RawAddress& bd_addr, uint8_t* p_sec_flags, -- 2.11.0