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

Commit ae0d2fe3 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

L2cap: Route some functions to shim

Tag: #gd-refactor
Bug: 141555841
Test: cert/run --host
Test: Pair and connect with a headset
Change-Id: I6ce4c8a7f7e506f370b81e7919fd15f490068b56
parent 3309f597
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -891,7 +891,12 @@ bool L2CA_DisconnectReq(uint16_t cid) {
  return (true);
}

bool L2CA_DisconnectLECocReq(uint16_t cid) { return L2CA_DisconnectReq(cid); }
bool L2CA_DisconnectLECocReq(uint16_t cid) {
  if (bluetooth::shim::is_gd_l2cap_enabled()) {
    return bluetooth::shim::L2CA_DisconnectLECocReq(cid);
  }
  return L2CA_DisconnectReq(cid);
}

bool L2CA_GetRemoteCid(uint16_t lcid, uint16_t* rcid) {
  if (bluetooth::shim::is_gd_l2cap_enabled()) {
@@ -1460,6 +1465,10 @@ uint8_t L2CA_DataWrite(uint16_t cid, BT_HDR* p_data) {
}

uint8_t L2CA_LECocDataWrite(uint16_t cid, BT_HDR* p_data) {
  if (bluetooth::shim::is_gd_l2cap_enabled()) {
    return bluetooth::shim::L2CA_LECocDataWrite(cid, p_data);
  }

  return L2CA_DataWrite(cid, p_data);
}

+13 −0
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@
#include <cstdint>

#include "device/include/controller.h"
#include "main/shim/l2c_api.h"
#include "main/shim/shim.h"
#include "osi/include/log.h"
#include "osi/include/osi.h"
#include "stack/btm/btm_dev.h"
@@ -124,6 +126,9 @@ void l2c_link_hci_conn_req(const RawAddress& bd_addr) {

void l2c_link_hci_conn_comp(uint8_t status, uint16_t handle,
                            const RawAddress& p_bda) {
  if (bluetooth::shim::is_gd_l2cap_enabled()) {
    return;
  }
  tL2C_CONN_INFO ci;
  tL2C_LCB* p_lcb;
  tL2C_CCB* p_ccb;
@@ -316,6 +321,11 @@ void l2c_link_sec_comp2(const RawAddress& p_bda,
 *
 ******************************************************************************/
bool l2c_link_hci_disc_comp(uint16_t handle, uint8_t reason) {
  if (bluetooth::shim::is_gd_l2cap_enabled()) {
    btm_acl_removed(handle);
    return false;
  }

  tL2C_LCB* p_lcb = l2cu_find_lcb_by_handle(handle);
  tL2C_CCB* p_ccb;
  bool status = true;
@@ -1137,6 +1147,9 @@ static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf) {
 *
 ******************************************************************************/
void l2c_link_process_num_completed_pkts(uint8_t* p, uint8_t evt_len) {
  if (bluetooth::shim::is_gd_l2cap_enabled()) {
    return;
  }
  uint8_t num_handles, xx;
  uint16_t handle;
  uint16_t num_sent;
+5 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include "hcidefs.h"
#include "l2c_int.h"
#include "l2cdefs.h"
#include "main/shim/l2c_api.h"
#include "main/shim/shim.h"
#include "osi/include/allocator.h"
#include "osi/include/log.h"
@@ -1476,6 +1477,10 @@ tL2C_CCB* l2cu_allocate_ccb(tL2C_LCB* p_lcb, uint16_t cid) {
 *
 ******************************************************************************/
bool l2cu_start_post_bond_timer(uint16_t handle) {
  if (bluetooth::shim::is_gd_l2cap_enabled()) {
    return true;
  }

  tL2C_LCB* p_lcb = l2cu_find_lcb_by_handle(handle);

  if (!p_lcb) return (true);