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

Commit 2c76ad36 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

Merge changes I580b6f31,I6040e3b1,Ic660f6a8,I3fe57804,I80bc8acd into main am: 640819fb

parents 9b5d4572 640819fb
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1851,7 +1851,8 @@ void bta_av_do_start(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
   * It would not hurt us, if the peer device wants us to be central
   * disable sniff mode unconditionally during streaming */
  tHCI_ROLE cur_role;
  if ((BTM_GetRole(p_scb->PeerAddress(), &cur_role) == BTM_SUCCESS) &&
  if ((get_btm_client_interface().link_policy.BTM_GetRole(p_scb->PeerAddress(), &cur_role) ==
       BTM_SUCCESS) &&
      (cur_role == HCI_ROLE_CENTRAL)) {
    BTM_block_role_switch_and_sniff_mode_for(p_scb->PeerAddress());
  } else {
@@ -2322,7 +2323,8 @@ void bta_av_start_ok(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
       * Because it would not hurt source, if the peer device wants source to be
       * central.
       * disable sniff mode unconditionally during streaming */
      if ((BTM_GetRole(p_scb->PeerAddress(), &cur_role) == BTM_SUCCESS) &&
      if ((get_btm_client_interface().link_policy.BTM_GetRole(p_scb->PeerAddress(), &cur_role) ==
           BTM_SUCCESS) &&
          (cur_role == HCI_ROLE_CENTRAL)) {
        BTM_block_role_switch_and_sniff_mode_for(p_scb->PeerAddress());
      } else {
+6 −4
Original line number Diff line number Diff line
@@ -39,11 +39,11 @@
#include "btif/include/btif_av_co.h"
#include "btif/include/btif_config.h"
#include "internal_include/bt_target.h"
#include "os/log.h"
#include "osi/include/allocator.h"
#include "stack/include/acl_api.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_uuid16.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/hci_error_code.h"
#include "stack/include/sdp_api.h"
#include "storage/config_keys.h"
@@ -919,7 +919,8 @@ static void bta_av_sys_rs_cback(tBTA_SYS_CONN_STATUS /* status */, tHCI_ROLE new
  }

  /* restore role switch policy, if role switch failed */
  if ((HCI_SUCCESS != hci_status) && (BTM_GetRole(peer_addr, &cur_role) == BTM_SUCCESS) &&
  if ((HCI_SUCCESS != hci_status) &&
      (get_btm_client_interface().link_policy.BTM_GetRole(peer_addr, &cur_role) == BTM_SUCCESS) &&
      (cur_role == HCI_ROLE_PERIPHERAL)) {
    BTM_unblock_role_switch_for(peer_addr);
  }
@@ -1039,7 +1040,7 @@ bool bta_av_switch_if_needed(tBTA_AV_SCB* p_scb) {
    if (p_scbi && (p_scb->hdi != i) &&   /* not the original channel */
        ((bta_av_cb.conn_audio & mask))) /* connected audio */
    {
      BTM_GetRole(p_scbi->PeerAddress(), &role);
      get_btm_client_interface().link_policy.BTM_GetRole(p_scbi->PeerAddress(), &role);
      /* this channel is open - clear the role switch link policy for this link
       */
      if (HCI_ROLE_CENTRAL != role) {
@@ -1076,7 +1077,8 @@ bool bta_av_switch_if_needed(tBTA_AV_SCB* p_scb) {
 ******************************************************************************/
bool bta_av_link_role_ok(tBTA_AV_SCB* p_scb, uint8_t bits) {
  tHCI_ROLE role;
  if (BTM_GetRole(p_scb->PeerAddress(), &role) != BTM_SUCCESS) {
  if (get_btm_client_interface().link_policy.BTM_GetRole(p_scb->PeerAddress(), &role) !=
      BTM_SUCCESS) {
    log::warn("Unable to find link role for device:{}", p_scb->PeerAddress());
    return true;
  }
+8 −2
Original line number Diff line number Diff line
@@ -3052,7 +3052,10 @@ void btm_sec_auth_complete(uint16_t handle, tHCI_STATUS status) {
                     hci_error_code_text(status));

      tHCI_ROLE role = HCI_ROLE_UNKNOWN;
      BTM_GetRole(p_dev_rec->bd_addr, &role);
      if (get_btm_client_interface().link_policy.BTM_GetRole(p_dev_rec->bd_addr, &role) !=
          BTM_SUCCESS) {
        log::warn("Unable to get link role peer:{}", p_dev_rec->bd_addr);
      }
      if (role == HCI_ROLE_CENTRAL) {
        // Encryption is required to start SM over BR/EDR
        // indicate that this is encryption after authentication
@@ -3228,7 +3231,10 @@ void btm_sec_encrypt_change(uint16_t handle, tHCI_STATUS status, uint8_t encr_en
      log::verbose("BR key is temporary, skip derivation of LE LTK");
    }
    tHCI_ROLE role = HCI_ROLE_UNKNOWN;
    BTM_GetRole(p_dev_rec->bd_addr, &role);
    if (get_btm_client_interface().link_policy.BTM_GetRole(p_dev_rec->bd_addr, &role) !=
        BTM_SUCCESS) {
      log::warn("Unable to get link policy role peer:{}", p_dev_rec->bd_addr);
    }
    if (p_dev_rec->sec_rec.new_encryption_key_is_p256) {
      if (btm_sec_use_smp_br_chnl(p_dev_rec) && role == HCI_ROLE_CENTRAL &&
          /* if LE key is not known, do deriving */
+0 −15
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ struct acl_set_peer_le_features_from_handle acl_set_peer_le_features_from_handle
struct acl_get_connection_from_address acl_get_connection_from_address;
struct btm_acl_for_bda btm_acl_for_bda;
struct acl_get_connection_from_handle acl_get_connection_from_handle;
struct BTM_GetRole BTM_GetRole;
struct BTM_ReadFailedContactCounter BTM_ReadFailedContactCounter;
struct BTM_ReadRSSI BTM_ReadRSSI;
struct BTM_ReadTxPower BTM_ReadTxPower;
@@ -78,10 +77,8 @@ struct BTM_SwitchRoleToCentral BTM_SwitchRoleToCentral;
struct btm_remove_acl btm_remove_acl;
struct btm_get_acl_disc_reason_code btm_get_acl_disc_reason_code;
struct btm_is_acl_locally_initiated btm_is_acl_locally_initiated;
struct BTM_GetMaxPacketSize BTM_GetMaxPacketSize;
struct BTM_GetNumAclLinks BTM_GetNumAclLinks;
struct acl_get_supported_packet_types acl_get_supported_packet_types;
struct BTM_GetPeerSCA BTM_GetPeerSCA;
struct acl_link_role_from_handle acl_link_role_from_handle;
struct btm_handle_to_acl_index btm_handle_to_acl_index;
struct BTM_ReadRemoteFeatures BTM_ReadRemoteFeatures;
@@ -261,10 +258,6 @@ tACL_CONN* acl_get_connection_from_handle(uint16_t handle) {
  inc_func_call_count(__func__);
  return test::mock::stack_acl::acl_get_connection_from_handle(handle);
}
tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, tHCI_ROLE* p_role) {
  inc_func_call_count(__func__);
  return test::mock::stack_acl::BTM_GetRole(remote_bd_addr, p_role);
}
tBTM_STATUS BTM_ReadFailedContactCounter(const RawAddress& remote_bda, tBTM_CMPL_CB* p_cb) {
  inc_func_call_count(__func__);
  return test::mock::stack_acl::BTM_ReadFailedContactCounter(remote_bda, p_cb);
@@ -298,10 +291,6 @@ bool btm_is_acl_locally_initiated(void) {
  inc_func_call_count(__func__);
  return test::mock::stack_acl::btm_is_acl_locally_initiated();
}
uint16_t BTM_GetMaxPacketSize(const RawAddress& addr) {
  inc_func_call_count(__func__);
  return test::mock::stack_acl::BTM_GetMaxPacketSize(addr);
}
uint16_t BTM_GetNumAclLinks(void) {
  inc_func_call_count(__func__);
  return test::mock::stack_acl::BTM_GetNumAclLinks();
@@ -310,10 +299,6 @@ uint16_t acl_get_supported_packet_types() {
  inc_func_call_count(__func__);
  return test::mock::stack_acl::acl_get_supported_packet_types();
}
uint8_t BTM_GetPeerSCA(const RawAddress& remote_bda, tBT_TRANSPORT transport) {
  inc_func_call_count(__func__);
  return test::mock::stack_acl::BTM_GetPeerSCA(remote_bda, transport);
}
uint8_t acl_link_role_from_handle(uint16_t handle) {
  inc_func_call_count(__func__);
  return test::mock::stack_acl::acl_link_role_from_handle(handle);
+0 −35
Original line number Diff line number Diff line
@@ -319,19 +319,6 @@ struct acl_get_connection_from_handle {
  tACL_CONN* operator()(uint16_t handle) { return body(handle); }
};
extern struct acl_get_connection_from_handle acl_get_connection_from_handle;
// Name: BTM_GetRole
// Params: const RawAddress& remote_bd_addr, tHCI_ROLE* p_role
// Returns: tBTM_STATUS
struct BTM_GetRole {
  std::function<tBTM_STATUS(const RawAddress& remote_bd_addr, tHCI_ROLE* p_role)> body{
          [](const RawAddress& /* remote_bd_addr */, tHCI_ROLE* /* p_role */) {
            return BTM_SUCCESS;
          }};
  tBTM_STATUS operator()(const RawAddress& remote_bd_addr, tHCI_ROLE* p_role) {
    return body(remote_bd_addr, p_role);
  }
};
extern struct BTM_GetRole BTM_GetRole;
// Name: BTM_ReadFailedContactCounter
// Params: const RawAddress& remote_bda, tBTM_CMPL_CB* p_cb
// Returns: tBTM_STATUS
@@ -417,15 +404,6 @@ struct btm_is_acl_locally_initiated {
  bool operator()(void) { return body(); }
};
extern struct btm_is_acl_locally_initiated btm_is_acl_locally_initiated;
// Name: BTM_GetMaxPacketSize
// Params: const RawAddress& addr
// Returns: uint16_t
struct BTM_GetMaxPacketSize {
  std::function<uint16_t(const RawAddress& addr)> body{
          [](const RawAddress& /* addr */) { return 0; }};
  uint16_t operator()(const RawAddress& addr) { return body(addr); }
};
extern struct BTM_GetMaxPacketSize BTM_GetMaxPacketSize;
// Name: BTM_GetNumAclLinks
// Params: void
// Returns: uint16_t
@@ -442,19 +420,6 @@ struct acl_get_supported_packet_types {
  uint16_t operator()() { return body(); }
};
extern struct acl_get_supported_packet_types acl_get_supported_packet_types;
// Name: BTM_GetPeerSCA
// Params: const RawAddress& remote_bda, tBT_TRANSPORT transport
// Returns: uint8_t
struct BTM_GetPeerSCA {
  std::function<uint8_t(const RawAddress& remote_bda, tBT_TRANSPORT transport)> body{
          [](const RawAddress& /* remote_bda */, tBT_TRANSPORT /* transport */) {
            return BT_TRANSPORT_BR_EDR;
          }};
  uint8_t operator()(const RawAddress& remote_bda, tBT_TRANSPORT transport) {
    return body(remote_bda, transport);
  }
};
extern struct BTM_GetPeerSCA BTM_GetPeerSCA;
// Name: acl_link_role_from_handle
// Params: uint16_t handle
// Returns: uint8_t
Loading