Loading android/app/jni/com_android_bluetooth_gatt.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -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, Loading Loading @@ -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}, Loading android/app/src/com/android/bluetooth/gatt/GattNativeInterface.java +12 −3 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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 */ Loading android/app/src/com/android/bluetooth/gatt/GattService.java +3 −1 Original line number Diff line number Diff line Loading @@ -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) Loading android/app/tests/unit/src/com/android/bluetooth/gatt/GattServiceTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -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 Loading system/bta/dm/bta_dm_disc.cc +7 −5 Original line number Diff line number Diff line Loading @@ -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) { Loading @@ -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); }, }; Loading Loading @@ -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); } } } Loading Loading
android/app/jni/com_android_bluetooth_gatt.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -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, Loading Loading @@ -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}, Loading
android/app/src/com/android/bluetooth/gatt/GattNativeInterface.java +12 −3 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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 */ Loading
android/app/src/com/android/bluetooth/gatt/GattService.java +3 −1 Original line number Diff line number Diff line Loading @@ -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) Loading
android/app/tests/unit/src/com/android/bluetooth/gatt/GattServiceTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -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 Loading
system/bta/dm/bta_dm_disc.cc +7 −5 Original line number Diff line number Diff line Loading @@ -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) { Loading @@ -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); }, }; Loading Loading @@ -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); } } } Loading