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

Commit 70c77135 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes Idc9dce13,If043f1a7,I0b944c99,Ifa9549ad,I9a485ba0 into main am: 955a57a6

parents fb93f99b 955a57a6
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@

#include "osi/include/allocator.h"
#include "stack/gatt/gatt_int.h"
#include "stack/include/l2c_api.h"
#include "stack/include/l2cap_interface.h"
#include "stack/include/l2cdefs.h"
#include "stack/include/main_thread.h"

@@ -112,8 +112,8 @@ void AclArbiter::SendPacketToPeer(uint8_t tcb_idx, ::rust::Vec<uint8_t> buffer)
    std::copy(buffer.begin(), buffer.end(), p);
    p_buf->offset = L2CAP_MIN_OFFSET;
    p_buf->len = buffer.size();
    if (L2CA_SendFixedChnlData(L2CAP_ATT_CID, p_tcb->peer_bda, p_buf) !=
        tL2CAP_DW_RESULT::SUCCESS) {
    if (stack::l2cap::get_interface().L2CA_SendFixedChnlData(L2CAP_ATT_CID, p_tcb->peer_bda,
                                                             p_buf) != tL2CAP_DW_RESULT::SUCCESS) {
      log::warn("Unable to send L2CAP data peer:{} fixed_cid:{} len:{}", p_tcb->peer_bda,
                L2CAP_ATT_CID, p_buf->len);
    }
+7 −5
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include "l2cdefs.h"
#include "osi/include/allocator.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/l2cap_interface.h"
#include "types/raw_address.h"

using namespace bluetooth;
@@ -68,8 +69,8 @@ void AVCT_Register() {
  }

  /* register PSM with L2CAP */
  if (!L2CA_RegisterWithSecurity(AVCT_PSM, avct_l2c_appl, true /* enable_snoop */, nullptr,
                                 kAvrcMtu, 0, sec)) {
  if (!stack::l2cap::get_interface().L2CA_RegisterWithSecurity(
              AVCT_PSM, avct_l2c_appl, true /* enable_snoop */, nullptr, kAvrcMtu, 0, sec)) {
    log::error("Unable to register with L2CAP AVCT profile psm:AVCT_PSM[0x0017]");
  }

@@ -77,8 +78,9 @@ void AVCT_Register() {
  tL2CAP_ERTM_INFO ertm_info;
  ertm_info.preferred_mode = L2CAP_FCR_ERTM_MODE;

  if (!L2CA_RegisterWithSecurity(AVCT_BR_PSM, avct_l2c_br_appl, true /*enable_snoop*/, &ertm_info,
                                 kAvrcBrMtu, AVCT_MIN_BROWSE_MTU, sec)) {
  if (!stack::l2cap::get_interface().L2CA_RegisterWithSecurity(
              AVCT_BR_PSM, avct_l2c_br_appl, true /*enable_snoop*/, &ertm_info, kAvrcBrMtu,
              AVCT_MIN_BROWSE_MTU, sec)) {
    log::error(
            "Unable to register with L2CAP AVCT_BR profile "
            "psm:AVCT_BR_PSM[0x001b]");
@@ -103,7 +105,7 @@ void AVCT_Deregister(void) {
  log::verbose("AVCT_Deregister");

  /* deregister PSM with L2CAP */
  L2CA_Deregister(AVCT_PSM);
  stack::l2cap::get_interface().L2CA_Deregister(AVCT_PSM);
}

/*******************************************************************************
+9 −6
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
#include "stack/avct/avct_defs.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_types.h"
#include "stack/include/l2cap_interface.h"

using namespace bluetooth;

@@ -117,11 +118,11 @@ void avct_bcb_chnl_open(tAVCT_BCB* p_bcb, tAVCT_LCB_EVT* /* p_data */) {
  /* call l2cap connect req */
  p_bcb->ch_state = AVCT_CH_CONN;
  if (com::android::bluetooth::flags::use_encrypt_req_for_av()) {
    p_bcb->ch_lcid = L2CA_ConnectReqWithSecurity(AVCT_BR_PSM, p_lcb->peer_addr,
      BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT);
    p_bcb->ch_lcid = stack::l2cap::get_interface().L2CA_ConnectReqWithSecurity(
            AVCT_BR_PSM, p_lcb->peer_addr, BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT);
  } else {
    p_bcb->ch_lcid = L2CA_ConnectReqWithSecurity(AVCT_BR_PSM, p_lcb->peer_addr,
      BTA_SEC_AUTHENTICATE);
    p_bcb->ch_lcid = stack::l2cap::get_interface().L2CA_ConnectReqWithSecurity(
            AVCT_BR_PSM, p_lcb->peer_addr, BTA_SEC_AUTHENTICATE);
  }
  if (p_bcb->ch_lcid == 0) {
    /* if connect req failed, send ourselves close event */
@@ -474,7 +475,8 @@ void avct_bcb_send_msg(tAVCT_BCB* p_bcb, tAVCT_LCB_EVT* p_data) {
  p_buf->layer_specific = AVCT_DATA_BROWSE;

  /* send message to L2CAP */
  if (L2CA_DataWrite(p_bcb->ch_lcid, p_buf) != tL2CAP_DW_RESULT::SUCCESS) {
  if (stack::l2cap::get_interface().L2CA_DataWrite(p_bcb->ch_lcid, p_buf) !=
      tL2CAP_DW_RESULT::SUCCESS) {
    log::warn("Unable to write L2CAP data peer:{} cid:{}", p_bcb->peer_addr, p_bcb->ch_lcid);
  }
}
@@ -582,7 +584,8 @@ void avct_bcb_msg_ind(tAVCT_BCB* p_bcb, tAVCT_LCB_EVT* p_data) {
    AVCT_BUILD_HDR(p, label, AVCT_PKT_TYPE_SINGLE, AVCT_REJ);
    UINT16_TO_BE_STREAM(p, pid);
    p_buf->layer_specific = AVCT_DATA_BROWSE;
    if (L2CA_DataWrite(p_bcb->ch_lcid, p_buf) != tL2CAP_DW_RESULT::SUCCESS) {
    if (stack::l2cap::get_interface().L2CA_DataWrite(p_bcb->ch_lcid, p_buf) !=
        tL2CAP_DW_RESULT::SUCCESS) {
      log::warn("Unable to write L2CAP data peer:{} cid:{}", p_bcb->peer_addr, p_bcb->ch_lcid);
    }
  }
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include "l2c_api.h"
#include "osi/include/fixed_queue.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/l2cap_interface.h"
#include "types/raw_address.h"

/*****************************************************************************
+5 −4
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include "l2cdefs.h"
#include "osi/include/allocator.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/l2cap_interface.h"
#include "types/raw_address.h"

using namespace bluetooth;
@@ -137,7 +138,7 @@ void avct_l2c_connect_ind_cback(const RawAddress& bd_addr, uint16_t lcid, uint16

  /* If we reject the connection, send DisconnectReq */
  if (result != tL2CAP_CONN::L2CAP_CONN_OK) {
    if (!L2CA_DisconnectReq(lcid)) {
    if (!stack::l2cap::get_interface().L2CA_DisconnectReq(lcid)) {
      log::warn("Unable to send L2CAP disconnect request peer:{} cid:{}", bd_addr, lcid);
    }
  }
@@ -186,7 +187,7 @@ static void avct_on_l2cap_error(uint16_t lcid, uint16_t result) {
    p_lcb->ch_result = result;

    /* Send L2CAP disconnect req */
    if (!L2CA_DisconnectReq(lcid)) {
    if (!stack::l2cap::get_interface().L2CA_DisconnectReq(lcid)) {
      log::warn("Unable to send L2CAP disconnect request peer:{} cid:{}", p_lcb->peer_addr, lcid);
    }
  }
@@ -230,7 +231,7 @@ void avct_l2c_connect_cfm_cback(uint16_t lcid, tL2CAP_CONN result) {
      if (result == tL2CAP_CONN::L2CAP_CONN_OK) {
        /* just in case the peer also accepts our connection - Send L2CAP
         * disconnect req */
        if (!L2CA_DisconnectReq(lcid)) {
        if (!stack::l2cap::get_interface().L2CA_DisconnectReq(lcid)) {
          log::warn("Unable to send L2CAP disconnect request peer:{} cid:{}", p_lcb->peer_addr,
                    lcid);
        }
@@ -321,7 +322,7 @@ void avct_l2c_disconnect_ind_cback(uint16_t lcid, bool /* ack_needed */) {
}

void avct_l2c_disconnect(uint16_t lcid, uint16_t result) {
  if (!L2CA_DisconnectReq(lcid)) {
  if (!stack::l2cap::get_interface().L2CA_DisconnectReq(lcid)) {
    log::warn("Unable to send L2CAP disconnect request cid:{}", lcid);
  }

Loading