Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a23bdc28 authored by Stanley Tng's avatar Stanley Tng Committed by android-build-merger
Browse files

Merge changes from topic "coc-test-increase-data-len"

am: 3ebdc420

Change-Id: Ic9340baf7dde702a26e954395acf5e64314d1b5d
parents 032528c5 3ebdc420
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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);
}
+17 −2
Original line number Diff line number Diff line
@@ -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;
@@ -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;
}
@@ -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:
+9 −0
Original line number Diff line number Diff line
@@ -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