diff options
| author | 2024-09-26 21:32:47 +0000 | |
|---|---|---|
| committer | 2024-09-27 18:18:24 +0000 | |
| commit | 7613d0c38945dac318def1372ecf2dc725513d8d (patch) | |
| tree | dcfa3cee83af05d7f7a8a02fabf6d1884a736acd | |
| parent | b62445cd42958921bc84857b956ffeafceb02014 (diff) | |
Send preferred MTU from GattService to native GATT module
Adding infrastructure to allow GattService to send application preferred ATT MTU to the native GATT module.
Bug: 369329192
Test: mmm packages/modules/Bluetooth
Flag: EXEMPT manual refactor
Change-Id: Icdb3eecca5adb18bbac12d2883b37ea4432e32b3
23 files changed, 95 insertions, 48 deletions
diff --git a/android/app/jni/com_android_bluetooth_gatt.cpp b/android/app/jni/com_android_bluetooth_gatt.cpp index e164923de8..fe17a63b8b 100644 --- a/android/app/jni/com_android_bluetooth_gatt.cpp +++ b/android/app/jni/com_android_bluetooth_gatt.cpp @@ -1387,13 +1387,14 @@ static void gattClientScanNative(JNIEnv* /* env */, jobject /* object */, jboole static void gattClientConnectNative(JNIEnv* env, jobject /* object */, jint clientif, jstring address, jint addressType, jboolean isDirect, - jint transport, jboolean opportunistic, jint initiating_phys) { + jint transport, jboolean opportunistic, jint initiating_phys, + jint preferred_mtu) { if (!sGattIf) { return; } sGattIf->client->connect(clientif, str2addr(env, address), addressType, isDirect, transport, - opportunistic, initiating_phys); + opportunistic, initiating_phys, preferred_mtu); } static void gattClientDisconnectNative(JNIEnv* env, jobject /* object */, jint clientIf, @@ -2842,7 +2843,7 @@ static int register_com_android_bluetooth_gatt_(JNIEnv* env) { (void*)gattClientGetDeviceTypeNative}, {"gattClientRegisterAppNative", "(JJZ)V", (void*)gattClientRegisterAppNative}, {"gattClientUnregisterAppNative", "(I)V", (void*)gattClientUnregisterAppNative}, - {"gattClientConnectNative", "(ILjava/lang/String;IZIZI)V", + {"gattClientConnectNative", "(ILjava/lang/String;IZIZII)V", (void*)gattClientConnectNative}, {"gattClientDisconnectNative", "(ILjava/lang/String;I)V", (void*)gattClientDisconnectNative}, diff --git a/android/app/src/com/android/bluetooth/gatt/GattNativeInterface.java b/android/app/src/com/android/bluetooth/gatt/GattNativeInterface.java index c0a2ca18ef..5adbbf2b93 100644 --- a/android/app/src/com/android/bluetooth/gatt/GattNativeInterface.java +++ b/android/app/src/com/android/bluetooth/gatt/GattNativeInterface.java @@ -293,7 +293,8 @@ public class GattNativeInterface { boolean isDirect, int transport, boolean opportunistic, - int initiatingPhys); + int initiatingPhys, + int preferredMtu); private native void gattClientDisconnectNative(int clientIf, String address, int connId); @@ -447,9 +448,17 @@ public class GattNativeInterface { boolean isDirect, int transport, boolean opportunistic, - int initiatingPhys) { + int initiatingPhys, + int preferredMtu) { gattClientConnectNative( - clientIf, address, addressType, isDirect, transport, opportunistic, initiatingPhys); + clientIf, + address, + addressType, + isDirect, + transport, + opportunistic, + initiatingPhys, + preferredMtu); } /** Disconnect from the remote Gatt server */ diff --git a/android/app/src/com/android/bluetooth/gatt/GattService.java b/android/app/src/com/android/bluetooth/gatt/GattService.java index b886b8f4d6..a6e4733150 100644 --- a/android/app/src/com/android/bluetooth/gatt/GattService.java +++ b/android/app/src/com/android/bluetooth/gatt/GattService.java @@ -2152,8 +2152,10 @@ public class GattService extends ProfileService { clientIf, BluetoothProtoEnums.CONNECTION_STATE_CONNECTING, -1); + + int preferredMtu = 0; mNativeInterface.gattClientConnect( - clientIf, address, addressType, isDirect, transport, opportunistic, phy); + clientIf, address, addressType, isDirect, transport, opportunistic, phy, preferredMtu); } @RequiresPermission(BLUETOOTH_CONNECT) diff --git a/android/app/tests/unit/src/com/android/bluetooth/gatt/GattServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/gatt/GattServiceTest.java index b71c71d52f..da45445ac2 100644 --- a/android/app/tests/unit/src/com/android/bluetooth/gatt/GattServiceTest.java +++ b/android/app/tests/unit/src/com/android/bluetooth/gatt/GattServiceTest.java @@ -265,7 +265,7 @@ public class GattServiceTest { verify(mNativeInterface) .gattClientConnect( - clientIf, address, addressType, isDirect, transport, opportunistic, phy); + clientIf, address, addressType, isDirect, transport, opportunistic, phy, 0); } @Test diff --git a/system/bta/dm/bta_dm_disc.cc b/system/bta/dm/bta_dm_disc.cc index 441a938a31..980f2d45f2 100644 --- a/system/bta/dm/bta_dm_disc.cc +++ b/system/bta/dm/bta_dm_disc.cc @@ -111,7 +111,8 @@ struct gatt_interface_t { void (*BTA_GATTC_Close)(tCONN_ID conn_id); void (*BTA_GATTC_ServiceSearchRequest)(tCONN_ID conn_id, const bluetooth::Uuid* p_srvc_uuid); void (*BTA_GATTC_Open)(tGATT_IF client_if, const RawAddress& remote_bda, - tBTM_BLE_CONN_TYPE connection_type, bool opportunistic); + tBTM_BLE_CONN_TYPE connection_type, bool opportunistic, + uint16_t preferred_mtu); } default_gatt_interface = { .BTA_GATTC_CancelOpen = [](tGATT_IF client_if, const RawAddress& remote_bda, bool is_direct) { @@ -138,8 +139,9 @@ struct gatt_interface_t { }, .BTA_GATTC_Open = [](tGATT_IF client_if, const RawAddress& remote_bda, - tBTM_BLE_CONN_TYPE connection_type, bool opportunistic) { - BTA_GATTC_Open(client_if, remote_bda, connection_type, opportunistic); + tBTM_BLE_CONN_TYPE connection_type, bool opportunistic, uint16_t preferred_mtu) { + BTA_GATTC_Open(client_if, remote_bda, BLE_ADDR_PUBLIC, connection_type, + BT_TRANSPORT_LE, opportunistic, 1, preferred_mtu); }, }; @@ -605,14 +607,14 @@ static void btm_dm_start_gatt_discovery(const RawAddress& bd_addr) { "transport:{} opportunistic:{:c}", bd_addr, bt_transport_text(BT_TRANSPORT_LE), (kUseOpportunistic) ? 'T' : 'F'); get_gatt_interface().BTA_GATTC_Open(bta_dm_discovery_cb.client_if, bd_addr, - BTM_BLE_DIRECT_CONNECTION, kUseOpportunistic); + BTM_BLE_DIRECT_CONNECTION, kUseOpportunistic, 0); } else { log::debug( "Opening new gatt client connection for discovery peer:{} " "transport:{} opportunistic:{:c}", bd_addr, bt_transport_text(BT_TRANSPORT_LE), (!kUseOpportunistic) ? 'T' : 'F'); get_gatt_interface().BTA_GATTC_Open(bta_dm_discovery_cb.client_if, bd_addr, - BTM_BLE_DIRECT_CONNECTION, !kUseOpportunistic); + BTM_BLE_DIRECT_CONNECTION, !kUseOpportunistic, 0); } } } diff --git a/system/bta/dm/bta_dm_gatt_client.cc b/system/bta/dm/bta_dm_gatt_client.cc index c9d7ba8e11..c9fec2d392 100644 --- a/system/bta/dm/bta_dm_gatt_client.cc +++ b/system/bta/dm/bta_dm_gatt_client.cc @@ -98,12 +98,13 @@ gatt_interface_t default_gatt_interface = { }, .BTA_GATTC_Open = [](tGATT_IF client_if, const RawAddress& remote_bda, - tBTM_BLE_CONN_TYPE connection_type, bool opportunistic) { + tBTM_BLE_CONN_TYPE connection_type, bool opportunistic, uint16_t preferred_mtu) { gatt_history_.Push(base::StringPrintf( "%-32s bd_addr:%s client_if:%hu type:0x%x opportunistic:%c", "GATTC_Open", ADDRESS_TO_LOGGABLE_CSTR(remote_bda), client_if, connection_type, (opportunistic) ? 'T' : 'F')); - BTA_GATTC_Open(client_if, remote_bda, connection_type, opportunistic); + BTA_GATTC_Open(client_if, remote_bda, BLE_ADDR_PUBLIC, connection_type, + BT_TRANSPORT_LE, opportunistic, 1, preferred_mtu); }, }; diff --git a/system/bta/dm/bta_dm_gatt_client.h b/system/bta/dm/bta_dm_gatt_client.h index b0071fd000..7f5540af7d 100644 --- a/system/bta/dm/bta_dm_gatt_client.h +++ b/system/bta/dm/bta_dm_gatt_client.h @@ -37,7 +37,8 @@ struct gatt_interface_t { void (*BTA_GATTC_Close)(tCONN_ID conn_id); void (*BTA_GATTC_ServiceSearchRequest)(tCONN_ID conn_id, const bluetooth::Uuid* p_srvc_uuid); void (*BTA_GATTC_Open)(tGATT_IF client_if, const RawAddress& remote_bda, - tBTM_BLE_CONN_TYPE connection_type, bool opportunistic); + tBTM_BLE_CONN_TYPE connection_type, bool opportunistic, + uint16_t preferred_mtu); }; // diff --git a/system/bta/gatt/bta_gattc_act.cc b/system/bta/gatt/bta_gattc_act.cc index bdcec86c9f..3437f15266 100644 --- a/system/bta/gatt/bta_gattc_act.cc +++ b/system/bta/gatt/bta_gattc_act.cc @@ -449,7 +449,7 @@ void bta_gattc_open(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data) { if (!GATT_Connect(p_clcb->p_rcb->client_if, p_data->api_conn.remote_bda, p_data->api_conn.remote_addr_type, BTM_BLE_DIRECT_CONNECTION, p_data->api_conn.transport, p_data->api_conn.opportunistic, - p_data->api_conn.initiating_phys)) { + p_data->api_conn.initiating_phys, p_data->api_conn.preferred_mtu)) { log::error("Connection open failure"); bta_gattc_sm_execute(p_clcb, BTA_GATTC_INT_OPEN_FAIL_EVT, p_data); return; @@ -484,8 +484,8 @@ static void bta_gattc_init_bk_conn(const tBTA_GATTC_API_OPEN* p_data, tBTA_GATTC } /* always call open to hold a connection */ - if (!GATT_Connect(p_data->client_if, p_data->remote_bda, p_data->connection_type, - p_data->transport, false)) { + if (!GATT_Connect(p_data->client_if, p_data->remote_bda, BLE_ADDR_PUBLIC, p_data->connection_type, + p_data->transport, false, 1, p_data->preferred_mtu)) { log::error("Unable to connect to remote bd_addr={}", p_data->remote_bda); bta_gattc_send_open_cback(p_clreg, GATT_ILLEGAL_PARAMETER, p_data->remote_bda, GATT_INVALID_CONN_ID, BT_TRANSPORT_LE, 0); diff --git a/system/bta/gatt/bta_gattc_api.cc b/system/bta/gatt/bta_gattc_api.cc index 2e41b2e23f..206cc94364 100644 --- a/system/bta/gatt/bta_gattc_api.cc +++ b/system/bta/gatt/bta_gattc_api.cc @@ -142,7 +142,7 @@ void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda, void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda, tBLE_ADDR_TYPE addr_type, tBTM_BLE_CONN_TYPE connection_type, tBT_TRANSPORT transport, bool opportunistic, - uint8_t initiating_phys) { + uint8_t initiating_phys, uint16_t preferred_mtu) { tBTA_GATTC_DATA data = { .api_conn = { @@ -157,12 +157,20 @@ void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda, tBLE_ADDR_ .initiating_phys = initiating_phys, .opportunistic = opportunistic, .remote_addr_type = addr_type, + .preferred_mtu = preferred_mtu, }, }; post_on_bt_main([data]() { bta_gattc_process_api_open(&data); }); } +void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda, tBLE_ADDR_TYPE addr_type, + tBTM_BLE_CONN_TYPE connection_type, tBT_TRANSPORT transport, bool opportunistic, + uint8_t initiating_phys) { + BTA_GATTC_Open(client_if, remote_bda, addr_type, connection_type, transport, opportunistic, + initiating_phys, 0); +} + void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda, tBTM_BLE_CONN_TYPE connection_type, tBT_TRANSPORT transport, bool opportunistic, uint8_t initiating_phys) { diff --git a/system/bta/gatt/bta_gattc_int.h b/system/bta/gatt/bta_gattc_int.h index c0cfc580e5..070e9c574b 100644 --- a/system/bta/gatt/bta_gattc_int.h +++ b/system/bta/gatt/bta_gattc_int.h @@ -110,6 +110,7 @@ typedef struct { uint8_t initiating_phys; bool opportunistic; tBT_DEVICE_TYPE remote_addr_type; + uint16_t preferred_mtu; } tBTA_GATTC_API_OPEN; typedef struct { diff --git a/system/bta/include/bta_gatt_api.h b/system/bta/include/bta_gatt_api.h index 0b55aa2074..1079e813ad 100644 --- a/system/bta/include/bta_gatt_api.h +++ b/system/bta/include/bta_gatt_api.h @@ -505,6 +505,9 @@ void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda, void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda, tBLE_ADDR_TYPE addr_type, tBTM_BLE_CONN_TYPE connection_type, tBT_TRANSPORT transport, bool opportunistic, uint8_t initiating_phys); +void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda, tBLE_ADDR_TYPE addr_type, + tBTM_BLE_CONN_TYPE connection_type, tBT_TRANSPORT transport, bool opportunistic, + uint8_t initiating_phys, uint16_t preferred_mtu); /******************************************************************************* * diff --git a/system/bta/test/common/bta_gatt_api_mock.cc b/system/bta/test/common/bta_gatt_api_mock.cc index d84d365d3f..e3ac011cd6 100644 --- a/system/bta/test/common/bta_gatt_api_mock.cc +++ b/system/bta/test/common/bta_gatt_api_mock.cc @@ -42,14 +42,6 @@ void BTA_GATTC_AppDeregister(tGATT_IF client_if) { } void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda, - tBTM_BLE_CONN_TYPE connection_type, tBT_TRANSPORT transport, bool opportunistic, - uint8_t initiating_phys) { - log::assert_that(gatt_interface != nullptr, "Mock GATT interface not set!"); - gatt_interface->Open(client_if, remote_bda, connection_type, transport, opportunistic, - initiating_phys); -} - -void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda, tBTM_BLE_CONN_TYPE connection_type, bool opportunistic) { log::assert_that(gatt_interface != nullptr, "Mock GATT interface not set!"); gatt_interface->Open(client_if, remote_bda, connection_type, opportunistic); diff --git a/system/btif/src/btif_gatt_client.cc b/system/btif/src/btif_gatt_client.cc index bed322206b..717e3574bc 100644 --- a/system/btif/src/btif_gatt_client.cc +++ b/system/btif/src/btif_gatt_client.cc @@ -300,7 +300,7 @@ static bt_status_t btif_gattc_unregister_app(int client_if) { void btif_gattc_open_impl(int client_if, RawAddress address, tBLE_ADDR_TYPE addr_type, bool is_direct, tBT_TRANSPORT transport, bool opportunistic, - int initiating_phys) { + int initiating_phys, int preferred_mtu) { int device_type = BT_DEVICE_TYPE_UNKNOWN; if (addr_type == BLE_ADDR_RANDOM) { @@ -358,16 +358,18 @@ void btif_gattc_open_impl(int client_if, RawAddress address, tBLE_ADDR_TYPE addr bt_transport_text(transport), DeviceTypeText(device_type), address, addr_type, initiating_phys); tBTM_BLE_CONN_TYPE type = is_direct ? BTM_BLE_DIRECT_CONNECTION : BTM_BLE_BKG_CONNECT_ALLOW_LIST; - BTA_GATTC_Open(client_if, address, addr_type, type, transport, opportunistic, initiating_phys); + BTA_GATTC_Open(client_if, address, addr_type, type, transport, opportunistic, initiating_phys, + preferred_mtu); } static bt_status_t btif_gattc_open(int client_if, const RawAddress& bd_addr, uint8_t addr_type, bool is_direct, int transport, bool opportunistic, - int initiating_phys) { + int initiating_phys, int preferred_mtu) { CHECK_BTGATT_INIT(); // Closure will own this value and free it. return do_in_jni_thread(Bind(&btif_gattc_open_impl, client_if, bd_addr, addr_type, is_direct, - to_bt_transport(transport), opportunistic, initiating_phys)); + to_bt_transport(transport), opportunistic, initiating_phys, + preferred_mtu)); } void btif_gattc_close_impl(int client_if, RawAddress address, int conn_id) { diff --git a/system/gd/rust/linux/stack/src/bluetooth_gatt.rs b/system/gd/rust/linux/stack/src/bluetooth_gatt.rs index 393b18727e..6c56ce6d9d 100644 --- a/system/gd/rust/linux/stack/src/bluetooth_gatt.rs +++ b/system/gd/rust/linux/stack/src/bluetooth_gatt.rs @@ -2272,6 +2272,7 @@ impl IBluetoothGatt for BluetoothGatt { transport.into(), opportunistic, phy.into(), + 0, ); } diff --git a/system/gd/rust/topshim/facade/src/gatt_service.rs b/system/gd/rust/topshim/facade/src/gatt_service.rs index 1653f69ff5..2baa3f1e74 100644 --- a/system/gd/rust/topshim/facade/src/gatt_service.rs +++ b/system/gd/rust/topshim/facade/src/gatt_service.rs @@ -479,7 +479,7 @@ impl GattService for GattServiceImpl { fn client_connect(&mut self, ctx: RpcContext<'_>, _req: Empty, sink: UnarySink<Empty>) { let client = &mut self.gatt.lock().unwrap().client; - client.connect(0, &self.create_raw_address(), 0, true, 0, true, 0); + client.connect(0, &self.create_raw_address(), 0, true, 0, true, 0, 0); ctx.spawn(async move { sink.success(Empty::default()).await.unwrap(); }) diff --git a/system/gd/rust/topshim/src/profiles/gatt.rs b/system/gd/rust/topshim/src/profiles/gatt.rs index 72a5faa90d..a6884310b6 100644 --- a/system/gd/rust/topshim/src/profiles/gatt.rs +++ b/system/gd/rust/topshim/src/profiles/gatt.rs @@ -1181,6 +1181,7 @@ impl GattClient { transport: i32, opportunistic: bool, initiating_phys: i32, + preferred_mtu: i32, ) -> BtStatus { BtStatus::from(ccall!( self, @@ -1191,7 +1192,8 @@ impl GattClient { is_direct, transport, opportunistic, - initiating_phys + initiating_phys, + preferred_mtu )) } diff --git a/system/include/hardware/bt_gatt_client.h b/system/include/hardware/bt_gatt_client.h index 200c00a36b..f6c4daeca8 100644 --- a/system/include/hardware/bt_gatt_client.h +++ b/system/include/hardware/bt_gatt_client.h @@ -210,7 +210,8 @@ typedef struct { /** Create a connection to a remote LE or dual-mode device */ bt_status_t (*connect)(int client_if, const RawAddress& bd_addr, uint8_t addr_type, - bool is_direct, int transport, bool opportunistic, int initiating_phys); + bool is_direct, int transport, bool opportunistic, int initiating_phys, + int preferred_mtu); /** Disconnect a remote device or cancel a pending connection */ bt_status_t (*disconnect)(int client_if, const RawAddress& bd_addr, int conn_id); diff --git a/system/stack/gatt/gatt_api.cc b/system/stack/gatt/gatt_api.cc index 3715292f89..aa143ee431 100644 --- a/system/stack/gatt/gatt_api.cc +++ b/system/stack/gatt/gatt_api.cc @@ -1457,7 +1457,7 @@ bool GATT_Connect(tGATT_IF gatt_if, const RawAddress& bd_addr, tBTM_BLE_CONN_TYP bool GATT_Connect(tGATT_IF gatt_if, const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type, tBTM_BLE_CONN_TYPE connection_type, tBT_TRANSPORT transport, bool opportunistic, - uint8_t initiating_phys) { + uint8_t initiating_phys, uint16_t /* preferred_mtu */) { /* Make sure app is registered */ tGATT_REG* p_reg = gatt_get_regcb(gatt_if); if (!p_reg) { @@ -1551,13 +1551,21 @@ bool GATT_Connect(tGATT_IF gatt_if, const RawAddress& bd_addr, tBLE_ADDR_TYPE ad tBTM_BLE_CONN_TYPE connection_type, tBT_TRANSPORT transport, bool opportunistic) { constexpr uint8_t kPhyLe1M = 0x01; // From the old controller shim. uint8_t phy = kPhyLe1M; - return GATT_Connect(gatt_if, bd_addr, addr_type, connection_type, transport, opportunistic, phy); + return GATT_Connect(gatt_if, bd_addr, addr_type, connection_type, transport, opportunistic, phy, + 0); } bool GATT_Connect(tGATT_IF gatt_if, const RawAddress& bd_addr, tBTM_BLE_CONN_TYPE connection_type, tBT_TRANSPORT transport, bool opportunistic, uint8_t initiating_phys) { return GATT_Connect(gatt_if, bd_addr, BLE_ADDR_PUBLIC, connection_type, transport, opportunistic, - initiating_phys); + initiating_phys, 0); +} + +bool GATT_Connect(tGATT_IF gatt_if, const RawAddress& bd_addr, tBTM_BLE_CONN_TYPE connection_type, + tBT_TRANSPORT transport, bool opportunistic, uint8_t initiating_phys, + uint16_t preferred_mtu) { + return GATT_Connect(gatt_if, bd_addr, BLE_ADDR_PUBLIC, connection_type, transport, opportunistic, + initiating_phys, preferred_mtu); } /******************************************************************************* diff --git a/system/stack/gatt/gatt_cl.cc b/system/stack/gatt/gatt_cl.cc index 28ee7fb4a3..7501468aa3 100644 --- a/system/stack/gatt/gatt_cl.cc +++ b/system/stack/gatt/gatt_cl.cc @@ -36,6 +36,7 @@ #include "stack/eatt/eatt.h" #include "stack/include/bt_types.h" #include "stack/include/btm_client_interface.h" +#include "stack/include/l2cdefs.h" #include "types/bluetooth/uuid.h" #define GATT_WRITE_LONG_HDR_SIZE 5 /* 1 opcode + 2 handle + 2 offset */ diff --git a/system/stack/include/gatt_api.h b/system/stack/include/gatt_api.h index abda34aa15..911df29023 100644 --- a/system/stack/include/gatt_api.h +++ b/system/stack/include/gatt_api.h @@ -1178,7 +1178,10 @@ void GATT_StartIf(tGATT_IF gatt_if); tBLE_ADDR_TYPE addr_type, tBTM_BLE_CONN_TYPE connection_type, tBT_TRANSPORT transport, bool opportunistic, uint8_t initiating_phys); - +[[nodiscard]] bool GATT_Connect(tGATT_IF gatt_if, const RawAddress& bd_addr, + tBLE_ADDR_TYPE addr_type, tBTM_BLE_CONN_TYPE connection_type, + tBT_TRANSPORT transport, bool opportunistic, + uint8_t initiating_phys, uint16_t preferred_transport); /******************************************************************************* * * Function GATT_CancelConnect diff --git a/system/test/mock/mock_bta_gattc_api.cc b/system/test/mock/mock_bta_gattc_api.cc index 1649ce8980..686868455c 100644 --- a/system/test/mock/mock_bta_gattc_api.cc +++ b/system/test/mock/mock_bta_gattc_api.cc @@ -112,6 +112,12 @@ void BTA_GATTC_Open(tGATT_IF /* client_if */, const RawAddress& /* remote_bda */ uint8_t /* initiating_phys */) { inc_func_call_count(__func__); } +void BTA_GATTC_Open(tGATT_IF /* client_if */, const RawAddress& /* remote_bda */, + tBLE_ADDR_TYPE /* addr_type */, tBTM_BLE_CONN_TYPE /* connection_type */, + tBT_TRANSPORT /* transport */, bool /* opportunistic */, + uint8_t /* initiating_phys */, uint16_t /* preferred_mtu */) { + inc_func_call_count(__func__); +} void BTA_GATTC_PrepareWrite(uint16_t /* conn_id */, uint16_t /* handle */, uint16_t /* offset */, std::vector<uint8_t> /* value */, tGATT_AUTH_REQ /* auth_req */, GATT_WRITE_OP_CB /* callback */, void* /* cb_data */) { diff --git a/system/test/mock/mock_stack_gatt_api.cc b/system/test/mock/mock_stack_gatt_api.cc index 947cc1a728..88b7af29a0 100644 --- a/system/test/mock/mock_stack_gatt_api.cc +++ b/system/test/mock/mock_stack_gatt_api.cc @@ -190,10 +190,11 @@ bool GATT_CancelConnect(tGATT_IF gatt_if, const RawAddress& bd_addr, bool is_dir } bool GATT_Connect(tGATT_IF gatt_if, const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type, tBTM_BLE_CONN_TYPE connection_type, tBT_TRANSPORT transport, bool opportunistic, - uint8_t initiating_phys) { + uint8_t initiating_phys, uint16_t preferred_mtu) { inc_func_call_count(__func__); return test::mock::stack_gatt_api::GATT_Connect(gatt_if, bd_addr, addr_type, connection_type, - transport, opportunistic, initiating_phys); + transport, opportunistic, initiating_phys, + preferred_mtu); } void GATT_Deregister(tGATT_IF gatt_if) { inc_func_call_count(__func__); @@ -243,7 +244,7 @@ bool GATT_Connect(tGATT_IF gatt_if, const RawAddress& bd_addr, tBTM_BLE_CONN_TYP tBT_TRANSPORT transport, bool opportunistic) { inc_func_call_count(__func__); return test::mock::stack_gatt_api::GATT_Connect(gatt_if, bd_addr, 0, connection_type, transport, - opportunistic, 0); + opportunistic, 0, 0); } // END mockcify generation diff --git a/system/test/mock/mock_stack_gatt_api.h b/system/test/mock/mock_stack_gatt_api.h index 8e1b4e5d99..74bf566f2f 100644 --- a/system/test/mock/mock_stack_gatt_api.h +++ b/system/test/mock/mock_stack_gatt_api.h @@ -284,21 +284,23 @@ extern struct GATT_CancelConnect GATT_CancelConnect; // Name: GATT_Connect // Params: tGATT_IF gatt_if, const RawAddress& bd_addr, bool is_direct, -// tBT_TRANSPORT transport, bool opportunistic, uint8_t initiating_phys Return: -// bool +// tBT_TRANSPORT transport, bool opportunistic, uint8_t initiating_phys, uint16_t preferred_mtu +// Return: bool struct GATT_Connect { static bool return_value; std::function<bool(tGATT_IF gatt_if, const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type, bool is_direct, tBT_TRANSPORT transport, bool opportunistic, - uint8_t initiating_phys)> + uint8_t initiating_phys, uint16_t preferred_mtu)> body{[](tGATT_IF /* gatt_if */, const RawAddress& /* bd_addr */, tBLE_ADDR_TYPE /* addr_type */, bool /* is_direct */, tBT_TRANSPORT /* transport */, bool /* opportunistic */, - uint8_t /* initiating_phys */) { return return_value; }}; + uint8_t /* initiating_phys */, + uint16_t /* preferred_mtu */) { return return_value; }}; bool operator()(tGATT_IF gatt_if, const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type, bool is_direct, tBT_TRANSPORT transport, bool opportunistic, - uint8_t initiating_phys) { - return body(gatt_if, bd_addr, addr_type, is_direct, transport, opportunistic, initiating_phys); + uint8_t initiating_phys, uint16_t preferred_mtu) { + return body(gatt_if, bd_addr, addr_type, is_direct, transport, opportunistic, initiating_phys, + preferred_mtu); } }; extern struct GATT_Connect GATT_Connect; |