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

Commit 32c50c63 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

stack::rnr Introduce btm_stack_rnr_test am: 2098b15e

parents 4d51194b 2098b15e
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@
#include "stack/include/btm_status.h"
#include "stack/include/main_thread.h"
#include "stack/include/rnr_interface.h"
#include "stack/rnr/remote_name_request.h"
#include "types/raw_address.h"

using namespace bluetooth;
@@ -514,7 +513,7 @@ static void bta_dm_discover_name(const RawAddress& remote_bd_addr) {
    bta_dm_search_cb.name_discover_done = true;
  }
  // If we already have the name we can skip getting the name
  if (BTM_IsRemoteNameKnown(remote_bd_addr, transport)) {
  if (get_stack_rnr_interface().BTM_IsRemoteNameKnown(remote_bd_addr, transport)) {
    log::debug("Security record already known skipping read remote name peer:{}", remote_bd_addr);
    bta_dm_search_cb.name_discover_done = true;
  }
+6 −7
Original line number Diff line number Diff line
@@ -405,8 +405,7 @@ static bool bta_dm_read_remote_device_name(const RawAddress& bd_addr, tBT_TRANSP
     * "bta_dm_remname_cback" */
    /* adding callback to get notified that current reading remote name done */

    get_btm_client_interface().security.BTM_SecAddRmtNameNotifyCallback(
            &bta_dm_service_search_remname_cback);
    get_stack_rnr_interface().BTM_SecAddRmtNameNotifyCallback(&bta_dm_service_search_remname_cback);

    return true;
  } else {
@@ -697,7 +696,7 @@ static void bta_dm_sdp_result(tBTA_DM_SDP_RESULT& sdp_event) {
      /* callbacks */
      /* start next bd_addr if necessary */

      get_btm_client_interface().security.BTM_SecDeleteRmtNameNotifyCallback(
      get_stack_rnr_interface().BTM_SecDeleteRmtNameNotifyCallback(
              &bta_dm_service_search_remname_cback);

      BTM_LogHistory(
@@ -753,7 +752,7 @@ static void bta_dm_sdp_result(tBTA_DM_SDP_RESULT& sdp_event) {
      osi_free_and_reset((void**)&bta_dm_search_cb.p_sdp_db);
    }

    get_btm_client_interface().security.BTM_SecDeleteRmtNameNotifyCallback(
    get_stack_rnr_interface().BTM_SecDeleteRmtNameNotifyCallback(
            &bta_dm_service_search_remname_cback);

    auto msg = std::make_unique<tBTA_DM_MSG>(tBTA_DM_SVC_RES{});
@@ -1160,7 +1159,7 @@ static void bta_dm_discover_name(const RawAddress& remote_bd_addr) {
    bta_dm_search_cb.name_discover_done = true;
  }
  // If we already have the name we can skip getting the name
  if (BTM_IsRemoteNameKnown(remote_bd_addr, transport)) {
  if (get_stack_rnr_interface().BTM_IsRemoteNameKnown(remote_bd_addr, transport)) {
    log::debug("Security record already known skipping read remote name peer:{}", remote_bd_addr);
    bta_dm_search_cb.name_discover_done = true;
  }
@@ -1429,14 +1428,14 @@ static void bta_dm_remname_cback(const tBTM_REMOTE_DEV_NAME* p_remote_name) {
          strnlen((const char*)p_remote_name->remote_bd_name, BD_NAME_LEN));

  if (bta_dm_search_cb.peer_bdaddr == p_remote_name->bd_addr) {
    get_btm_client_interface().security.BTM_SecDeleteRmtNameNotifyCallback(
    get_stack_rnr_interface().BTM_SecDeleteRmtNameNotifyCallback(
            &bta_dm_service_search_remname_cback);
  } else {
    // if we got a different response, maybe ignore it
    // we will have made a request directly from BTM_ReadRemoteDeviceName so we
    // expect a dedicated response for us
    if (p_remote_name->hci_status == HCI_ERR_CONNECTION_EXISTS) {
      get_btm_client_interface().security.BTM_SecDeleteRmtNameNotifyCallback(
      get_stack_rnr_interface().BTM_SecDeleteRmtNameNotifyCallback(
              &bta_dm_service_search_remname_cback);
      log::info("Assume command failed due to disconnection hci_status:{} peer:{}",
                hci_error_code_text(p_remote_name->hci_status), p_remote_name->bd_addr);
+3 −2
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@
#include "stack/include/btm_log_history.h"
#include "stack/include/btm_sec_api.h"
#include "stack/include/btm_sec_api_types.h"
#include "stack/include/rnr_interface.h"
#include "stack/include/smp_api.h"
#include "stack/include/srvc_api.h"  // tDIS_VALUE
#include "storage/config_keys.h"
@@ -1973,7 +1974,7 @@ void BTIF_dm_enable() {
  BTA_DmBleConfigLocalPrivacy(ble_privacy_enabled);

  if (com::android::bluetooth::flags::separate_service_and_device_discovery()) {
    get_security_client_interface().BTM_SecAddRmtNameNotifyCallback(btif_on_name_read_from_btm);
    get_stack_rnr_interface().BTM_SecAddRmtNameNotifyCallback(btif_on_name_read_from_btm);
  }

  /* for each of the enabled services in the mask, trigger the profile
@@ -2001,7 +2002,7 @@ void BTIF_dm_enable() {

void BTIF_dm_disable() {
  if (com::android::bluetooth::flags::separate_service_and_device_discovery()) {
    get_security_client_interface().BTM_SecDeleteRmtNameNotifyCallback(&btif_on_name_read_from_btm);
    get_stack_rnr_interface().BTM_SecDeleteRmtNameNotifyCallback(&btif_on_name_read_from_btm);
  }

  /* for each of the enabled services in the mask, trigger the profile
+1 −0
Original line number Diff line number Diff line
@@ -287,6 +287,7 @@ cc_test {
        ":TestMockLegacyHciCommands",
        ":TestMockLegacyHciInterface",
        ":TestMockStack",
        ":TestMockStackRnr",
        "test/main_shim_stack_dumpsys_test.cc",
    ],
    static_libs: [
+13 −12
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
#include "stack/btm/security_device_record.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/main_thread.h"
#include "stack/include/rnr_interface.h"
#include "stack/rnr/remote_name_request.h"
#include "types/ble_address_with_type.h"
#include "types/raw_address.h"
@@ -203,8 +204,8 @@ void bluetooth::shim::ACL_RemoteNameRequest(const RawAddress& addr, uint8_t page
                        // Callsites that want the address should use
                        // StartRemoteNameRequest() directly, rather
                        // than going through this shim.
                        btm_process_remote_name(nullptr, nullptr, 0,
                                                static_cast<tHCI_STATUS>(status));
                        get_stack_rnr_interface().btm_process_remote_name(
                                nullptr, nullptr, 0, static_cast<tHCI_STATUS>(status));
                        btm_sec_rmt_name_request_complete(nullptr, nullptr,
                                                          static_cast<tHCI_STATUS>(status));
                      },
@@ -220,14 +221,14 @@ void bluetooth::shim::ACL_RemoteNameRequest(const RawAddress& addr, uint8_t page
                  addr),
          GetGdShimHandler()->BindOnce(
                  [](RawAddress addr, hci::ErrorCode status, std::array<uint8_t, 248> name) {
                    do_in_main_thread(
                            base::BindOnce(
                    do_in_main_thread(base::BindOnce(
                            [](RawAddress addr, hci::ErrorCode status,
                               std::array<uint8_t, 248> name) {
                                      btm_process_remote_name(&addr, name.data(), name.size(),
                              get_stack_rnr_interface().btm_process_remote_name(
                                      &addr, name.data(), name.size(),
                                      static_cast<tHCI_STATUS>(status));
                              btm_sec_rmt_name_request_complete(&addr, name.data(),
                                                                static_cast<tHCI_STATUS>(status));
                                      btm_sec_rmt_name_request_complete(
                                              &addr, name.data(), static_cast<tHCI_STATUS>(status));
                            },
                            addr, status, name));
                  },
Loading