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

Commit 30756ec0 authored by Chris Manton's avatar Chris Manton Committed by Gerrit Code Review
Browse files

Merge changes I8c2e5eae,I9660f96b,Ic160eb03,Ic088055e,I4744e1d0 into main

* changes:
  mock: [30/63] Remove BTM_IsAclConnectionUpAndHandleValid
  mock: [29/63] Remove BTM_IsAclConnectionUp
  mock: [28/63] Remove BTM_InqDbRead
  mock: [27/63] Remove BTM_InqDbNext
  mock: [26/63] Remove BTM_InqDbFirst
parents de499902 533478a3
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -5693,9 +5693,11 @@ private:
         tmpDevice = group->GetNextDevice(tmpDevice)) {
         tmpDevice = group->GetNextDevice(tmpDevice)) {
      log::info("tmpDevice->acl_asymmetric_: {}, asymmetric: {}, address: {}, acl_connected: {}",
      log::info("tmpDevice->acl_asymmetric_: {}, asymmetric: {}, address: {}, acl_connected: {}",
                tmpDevice->acl_asymmetric_ == asymmetric, asymmetric, tmpDevice->address_,
                tmpDevice->acl_asymmetric_ == asymmetric, asymmetric, tmpDevice->address_,
                BTM_IsAclConnectionUp(tmpDevice->address_, BT_TRANSPORT_LE));
                get_btm_client_interface().peer.BTM_IsAclConnectionUp(tmpDevice->address_,
                                                                      BT_TRANSPORT_LE));
      if (tmpDevice->acl_asymmetric_ == asymmetric ||
      if (tmpDevice->acl_asymmetric_ == asymmetric ||
          !BTM_IsAclConnectionUp(tmpDevice->address_, BT_TRANSPORT_LE)) {
          !get_btm_client_interface().peer.BTM_IsAclConnectionUp(tmpDevice->address_,
                                                                 BT_TRANSPORT_LE)) {
        continue;
        continue;
      }
      }


+4 −5
Original line number Original line Diff line number Diff line
@@ -53,6 +53,10 @@ void bluetooth::manager::SetMockBtmInterface(MockBtmInterface* mock_btm_interfac
                                                   uint8_t rx_phys, uint16_t phy_options) {
                                                   uint8_t rx_phys, uint16_t phy_options) {
    btm_interface->BleSetPhy(bd_addr, tx_phys, rx_phys, phy_options);
    btm_interface->BleSetPhy(bd_addr, tx_phys, rx_phys, phy_options);
  };
  };
  mock_btm_client_interface.peer.BTM_IsAclConnectionUp = [](const RawAddress& remote_bda,
                                                            tBT_TRANSPORT transport) {
    return btm_interface->BTM_IsAclConnectionUp(remote_bda, transport);
  };
}
}


bool BTM_IsLinkKeyKnown(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
bool BTM_IsLinkKeyKnown(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
@@ -109,11 +113,6 @@ bool BTM_BleIsLinkKeyKnown(const RawAddress address) {
  return btm_interface->BTM_BleIsLinkKeyKnown(address);
  return btm_interface->BTM_BleIsLinkKeyKnown(address);
}
}


bool BTM_IsAclConnectionUp(const RawAddress& remote_bda, tBT_TRANSPORT transport) {
  log::assert_that(btm_interface != nullptr, "Mock btm interface not set!");
  return btm_interface->BTM_IsAclConnectionUp(remote_bda, transport);
}

std::optional<tBLE_BD_ADDR> BTM_BleGetIdentityAddress(const RawAddress address) {
std::optional<tBLE_BD_ADDR> BTM_BleGetIdentityAddress(const RawAddress address) {
  log::assert_that(btm_interface != nullptr, "Mock btm interface not set!");
  log::assert_that(btm_interface != nullptr, "Mock btm interface not set!");
  return btm_interface->BTM_BleGetIdentityAddress(address);
  return btm_interface->BTM_BleGetIdentityAddress(address);
+3 −2
Original line number Original line Diff line number Diff line
@@ -3342,7 +3342,8 @@ static void btif_dm_ble_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) {


      if (com::android::bluetooth::flags::read_model_num_fix() &&
      if (com::android::bluetooth::flags::read_model_num_fix() &&
          is_le_audio_capable_during_service_discovery(bd_addr) &&
          is_le_audio_capable_during_service_discovery(bd_addr) &&
          !btif_model_name_known(bd_addr) && BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) {
          !btif_model_name_known(bd_addr) &&
          get_btm_client_interface().peer.BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) {
        log::info("Read model name for le audio capable device");
        log::info("Read model name for le audio capable device");
        if (!DIS_ReadDISInfo(bd_addr, read_dis_cback, DIS_ATTR_MODEL_NUM_BIT)) {
        if (!DIS_ReadDISInfo(bd_addr, read_dis_cback, DIS_ATTR_MODEL_NUM_BIT)) {
          log::warn("Read DIS failed");
          log::warn("Read DIS failed");
@@ -3937,7 +3938,7 @@ void btif_dm_metadata_changed(const RawAddress& remote_bd_addr, int key,
    // TODO(b/334067583): Remove this DIS read when b/334067583 is fixed
    // TODO(b/334067583): Remove this DIS read when b/334067583 is fixed
    if (com::android::bluetooth::flags::read_model_num_fix() &&
    if (com::android::bluetooth::flags::read_model_num_fix() &&
        !btif_model_name_known(remote_bd_addr) &&
        !btif_model_name_known(remote_bd_addr) &&
        BTM_IsAclConnectionUp(remote_bd_addr, BT_TRANSPORT_LE)) {
        get_btm_client_interface().peer.BTM_IsAclConnectionUp(remote_bd_addr, BT_TRANSPORT_LE)) {
      log::info("Read model name for le audio capable device");
      log::info("Read model name for le audio capable device");
      if (!DIS_ReadDISInfo(remote_bd_addr, read_dis_cback, DIS_ATTR_MODEL_NUM_BIT)) {
      if (!DIS_ReadDISInfo(remote_bd_addr, read_dis_cback, DIS_ATTR_MODEL_NUM_BIT)) {
        log::warn("Read DIS failed");
        log::warn("Read DIS failed");
+4 −3
Original line number Original line Diff line number Diff line
@@ -44,10 +44,10 @@
#include "include/hardware/bt_hh.h"
#include "include/hardware/bt_hh.h"
#include "main/shim/dumpsys.h"
#include "main/shim/dumpsys.h"
#include "osi/include/allocator.h"
#include "osi/include/allocator.h"
#include "stack/include/acl_api.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_uuid16.h"
#include "stack/include/bt_uuid16.h"
#include "stack/include/btm_ble_api.h"
#include "stack/include/btm_ble_api.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/hidh_api.h"
#include "stack/include/hidh_api.h"
#include "types/raw_address.h"
#include "types/raw_address.h"


@@ -1487,8 +1487,9 @@ static void btif_hh_transport_select(tAclLinkSpec& link_spec) {
  BTM_ReadDevInfo(bd_addr, &dev_type, &addr_type);
  BTM_ReadDevInfo(bd_addr, &dev_type, &addr_type);


  // Find which transports are already connected
  // Find which transports are already connected
  bool bredr_acl = BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_BR_EDR);
  bool bredr_acl =
  bool le_acl = BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE);
          get_btm_client_interface().peer.BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_BR_EDR);
  bool le_acl = get_btm_client_interface().peer.BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE);


  // Find which services known to be available
  // Find which services known to be available
  if (btif_storage_get_remote_device_property(&bd_addr, &remote_properties) == BT_STATUS_SUCCESS) {
  if (btif_storage_get_remote_device_property(&bd_addr, &remote_properties) == BT_STATUS_SUCCESS) {
+4 −4
Original line number Original line Diff line number Diff line
@@ -121,9 +121,9 @@ void btm_ble_test_command_complete(uint8_t* p) {
 *
 *
 ******************************************************************************/
 ******************************************************************************/
bool BTM_UseLeLink(const RawAddress& bd_addr) {
bool BTM_UseLeLink(const RawAddress& bd_addr) {
  if (BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_BR_EDR)) {
  if (get_btm_client_interface().peer.BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_BR_EDR)) {
    return false;
    return false;
  } else if (BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) {
  } else if (get_btm_client_interface().peer.BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) {
    return true;
    return true;
  }
  }


@@ -164,7 +164,7 @@ void read_phy_cb(base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t sta
 ******************************************************************************/
 ******************************************************************************/
void BTM_BleReadPhy(const RawAddress& bd_addr,
void BTM_BleReadPhy(const RawAddress& bd_addr,
                    base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb) {
                    base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb) {
  if (!BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) {
  if (!get_btm_client_interface().peer.BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) {
    log::error("Wrong mode: no LE link exist or LE not supported");
    log::error("Wrong mode: no LE link exist or LE not supported");
    cb.Run(0, 0, HCI_ERR_NO_CONNECTION);
    cb.Run(0, 0, HCI_ERR_NO_CONNECTION);
    return;
    return;
@@ -192,7 +192,7 @@ void doNothing(uint8_t* /* data */, uint16_t /* len */) {}


void BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys, uint8_t rx_phys,
void BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys, uint8_t rx_phys,
                   uint16_t phy_options) {
                   uint16_t phy_options) {
  if (!BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) {
  if (!get_btm_client_interface().peer.BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) {
    log::info(
    log::info(
            "Unable to set phy preferences because no le acl is connected to "
            "Unable to set phy preferences because no le acl is connected to "
            "device");
            "device");
Loading