Loading system/binder/android/bluetooth/IBluetoothSocketManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -29,4 +29,5 @@ interface IBluetoothSocketManager { @nullable ParcelFileDescriptor connectSocket(in BluetoothDevice device, int type, in @nullable ParcelUuid uuid, int port, int flag); @nullable ParcelFileDescriptor createSocketChannel(int type, in @nullable String serviceName, in @nullable ParcelUuid uuid, int port, int flag); void requestMaximumTxDataLength(in BluetoothDevice device); } system/btif/src/btif_sock.cc +17 −2 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ #include "btif_sock_thread.h" #include "btif_uid.h" #include "btif_util.h" #include "device/include/controller.h" #include "osi/include/thread.h" using bluetooth::Uuid; Loading @@ -45,14 +46,19 @@ static bt_status_t btsock_connect(const RawAddress* bd_addr, btsock_type_t type, const Uuid* uuid, int channel, int* sock_fd, int flags, int app_uid); static void btsock_request_max_tx_data_length(const RawAddress& bd_addr); static void btsock_signaled(int fd, int type, int flags, uint32_t user_id); static std::atomic_int thread_handle{-1}; static thread_t* thread; const btsock_interface_t* btif_sock_get_interface(void) { static btsock_interface_t interface = {sizeof(interface), btsock_listen, btsock_connect}; static btsock_interface_t interface = { sizeof(interface), btsock_listen, /* listen */ btsock_connect, /* connect */ btsock_request_max_tx_data_length /* request_max_tx_data_length */ }; return &interface; } Loading Loading @@ -210,6 +216,15 @@ static bt_status_t btsock_connect(const RawAddress* bd_addr, btsock_type_t type, return status; } static void btsock_request_max_tx_data_length(const RawAddress& remote_device) { const controller_t* controller = controller_get_interface(); uint16_t max_len = controller->get_ble_maximum_tx_data_length(); DVLOG(2) << __func__ << ": max_len=" << max_len; BTA_DmBleSetDataLength(remote_device, max_len); } static void btsock_signaled(int fd, int type, int flags, uint32_t user_id) { switch (type) { case BTSOCK_RFCOMM: Loading system/include/hardware/bt_sock.h +9 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,15 @@ typedef struct { bt_status_t (*connect)(const RawAddress* bd_addr, btsock_type_t type, const bluetooth::Uuid* uuid, int channel, int* sock_fd, int flags, int callingUid); /** * Set the LE Data Length value to this connected peer to the * maximum supported by this BT controller. This command * suggests to the BT controller to set its maximum transmission * packet size. */ void (*request_max_tx_data_length)(const RawAddress& bd_addr); } btsock_interface_t; __END_DECLS Loading
system/binder/android/bluetooth/IBluetoothSocketManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -29,4 +29,5 @@ interface IBluetoothSocketManager { @nullable ParcelFileDescriptor connectSocket(in BluetoothDevice device, int type, in @nullable ParcelUuid uuid, int port, int flag); @nullable ParcelFileDescriptor createSocketChannel(int type, in @nullable String serviceName, in @nullable ParcelUuid uuid, int port, int flag); void requestMaximumTxDataLength(in BluetoothDevice device); }
system/btif/src/btif_sock.cc +17 −2 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ #include "btif_sock_thread.h" #include "btif_uid.h" #include "btif_util.h" #include "device/include/controller.h" #include "osi/include/thread.h" using bluetooth::Uuid; Loading @@ -45,14 +46,19 @@ static bt_status_t btsock_connect(const RawAddress* bd_addr, btsock_type_t type, const Uuid* uuid, int channel, int* sock_fd, int flags, int app_uid); static void btsock_request_max_tx_data_length(const RawAddress& bd_addr); static void btsock_signaled(int fd, int type, int flags, uint32_t user_id); static std::atomic_int thread_handle{-1}; static thread_t* thread; const btsock_interface_t* btif_sock_get_interface(void) { static btsock_interface_t interface = {sizeof(interface), btsock_listen, btsock_connect}; static btsock_interface_t interface = { sizeof(interface), btsock_listen, /* listen */ btsock_connect, /* connect */ btsock_request_max_tx_data_length /* request_max_tx_data_length */ }; return &interface; } Loading Loading @@ -210,6 +216,15 @@ static bt_status_t btsock_connect(const RawAddress* bd_addr, btsock_type_t type, return status; } static void btsock_request_max_tx_data_length(const RawAddress& remote_device) { const controller_t* controller = controller_get_interface(); uint16_t max_len = controller->get_ble_maximum_tx_data_length(); DVLOG(2) << __func__ << ": max_len=" << max_len; BTA_DmBleSetDataLength(remote_device, max_len); } static void btsock_signaled(int fd, int type, int flags, uint32_t user_id) { switch (type) { case BTSOCK_RFCOMM: Loading
system/include/hardware/bt_sock.h +9 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,15 @@ typedef struct { bt_status_t (*connect)(const RawAddress* bd_addr, btsock_type_t type, const bluetooth::Uuid* uuid, int channel, int* sock_fd, int flags, int callingUid); /** * Set the LE Data Length value to this connected peer to the * maximum supported by this BT controller. This command * suggests to the BT controller to set its maximum transmission * packet size. */ void (*request_max_tx_data_length)(const RawAddress& bd_addr); } btsock_interface_t; __END_DECLS