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

Commit f0e5bee8 authored by Hui Peng's avatar Hui Peng Committed by Gerrit Code Review
Browse files

Merge "[Invisalign2] Separate security related data structure in btm" into main

parents 25c7bdf3 3604b9a7
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@
#include "osi/include/allocator.h"
#include "stack/acl/acl.h"
#include "stack/btm/btm_int_types.h"
#include "stack/btm/btm_sec_int_types.h"
#include "stack/include/bt_hdr.h"
#include "stack/l2cap/l2c_int.h"
#include "types/ble_address_with_type.h"
@@ -1306,14 +1307,14 @@ void DumpsysBtm(int fd) {
void DumpsysRecord(int fd) {
  LOG_DUMPSYS_TITLE(fd, DUMPSYS_TAG);

  if (btm_cb.sec_dev_rec == nullptr) {
  if (btm_sec_cb.sec_dev_rec == nullptr) {
    LOG_DUMPSYS(fd, "Record is empty - no devices");
    return;
  }

  unsigned cnt = 0;
  list_node_t* end = list_end(btm_cb.sec_dev_rec);
  for (list_node_t* node = list_begin(btm_cb.sec_dev_rec); node != end;
  list_node_t* end = list_end(btm_sec_cb.sec_dev_rec);
  for (list_node_t* node = list_begin(btm_sec_cb.sec_dev_rec); node != end;
       node = list_next(node)) {
    tBTM_SEC_DEV_REC* p_dev_rec =
        static_cast<tBTM_SEC_DEV_REC*>(list_node(node));
+7 −6
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
#include "main/shim/le_scanning_manager.h"
#include "main/shim/shim.h"
#include "stack/btm/btm_int_types.h"
#include "stack/btm/btm_sec_int_types.h"
#include "stack/include/btm_log_history.h"
#include "storage/device.h"
#include "storage/le_device.h"
@@ -167,14 +168,14 @@ void BleScannerInterfaceImpl::Unregister(int scanner_id) {
void BleScannerInterfaceImpl::Scan(bool start) {
  LOG(INFO) << __func__ << " in shim layer " <<  ((start) ? "started" : "stopped");
  bluetooth::shim::GetScanning()->Scan(start);
  if (start && !btm_cb.ble_ctr_cb.is_ble_observe_active()) {
  if (start && !btm_sec_cb.ble_ctr_cb.is_ble_observe_active()) {
    btm_cb.neighbor.le_scan = {
        .start_time_ms = timestamper_in_milliseconds.GetTimestamp(),
        .results = 0,
    };
    BTM_LogHistory(kBtmLogTag, RawAddress::kEmpty, "Le scan started");
    btm_cb.ble_ctr_cb.set_ble_observe_active();
  } else if (!start && btm_cb.ble_ctr_cb.is_ble_observe_active()) {
    btm_sec_cb.ble_ctr_cb.set_ble_observe_active();
  } else if (!start && btm_sec_cb.ble_ctr_cb.is_ble_observe_active()) {
    // stopped
    const unsigned long long duration_timestamp =
        timestamper_in_milliseconds.GetTimestamp() -
@@ -183,11 +184,11 @@ void BleScannerInterfaceImpl::Scan(bool start) {
                   base::StringPrintf("duration_s:%6.3f results:%-3lu",
                                      (double)duration_timestamp / 1000.0,
                                      btm_cb.neighbor.le_scan.results));
    btm_cb.ble_ctr_cb.reset_ble_observe();
    btm_sec_cb.ble_ctr_cb.reset_ble_observe();
    btm_cb.neighbor.le_scan = {};
  } else {
    LOG_WARN("Invalid state: start:%d, current scan state: %d", start,
             btm_cb.ble_ctr_cb.is_ble_observe_active());
             btm_sec_cb.ble_ctr_cb.is_ble_observe_active());
    return;
  }

@@ -344,7 +345,7 @@ void BleScannerInterfaceImpl::SetScanParameters(int scanner_id,
                                                int scan_interval,
                                                int scan_window, Callback cb) {
  LOG(INFO) << __func__ << " in shim layer";
  tBTM_BLE_INQ_CB* p_cb = &btm_cb.ble_ctr_cb.inq_var;
  tBTM_BLE_INQ_CB* p_cb = &btm_sec_cb.ble_ctr_cb.inq_var;
  if (BTM_BLE_ISVALID_PARAM(scan_interval, BTM_BLE_SCAN_INT_MIN,
                            BTM_BLE_EXT_SCAN_INT_MAX) &&
      BTM_BLE_ISVALID_PARAM(scan_window, BTM_BLE_SCAN_WIN_MIN,
+2 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@
#include "os/thread.h"
#include "packet/packet_view.h"
#include "stack/btm/btm_int_types.h"
#include "stack/btm/btm_sec_int_types.h"
#include "stack/include/acl_hci_link_interface.h"
#include "stack/include/ble_acl_interface.h"
#include "stack/include/bt_hdr.h"
@@ -83,6 +84,7 @@ const uint8_t kMaxAddressResolutionSize = kMaxLeAcceptlistSize;

tL2C_CB l2cb;
tBTM_CB btm_cb;
tBTM_SEC_CB btm_sec_cb;
btif_hh_cb_t btif_hh_cb;

struct bluetooth::hci::LeScanningManager::impl
+1 −0
Original line number Diff line number Diff line
@@ -1549,6 +1549,7 @@ cc_test {
        "test/btm/sco_pkt_status_test.cc",
        "test/btm/stack_btm_power_mode_test.cc",
        "test/btm/stack_btm_regression_tests.cc",
        "test/btm/stack_btm_sec_test.cc",
        "test/btm/stack_btm_test.cc",
        "test/common/mock_eatt.cc",
        "test/stack_include_test.cc",
+4 −3
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include "stack/btm/btm_ble_int.h"
#include "stack/btm/btm_dev.h"
#include "stack/btm/btm_sec.h"
#include "stack/btm/btm_sec_int_types.h"
#include "stack/gatt/connection_manager.h"
#include "stack/include/acl_api.h"
#include "stack/include/l2cap_hci_link_interface.h"
@@ -37,7 +38,7 @@ static bool acl_ble_common_connection(
    bool is_in_security_db, uint16_t conn_interval, uint16_t conn_latency,
    uint16_t conn_timeout, bool can_read_discoverable_characteristics) {
  if (role == HCI_ROLE_CENTRAL) {
    btm_cb.ble_ctr_cb.set_connection_state_idle();
    btm_sec_cb.ble_ctr_cb.set_connection_state_idle();
    btm_ble_clear_topology_mask(BTM_BLE_STATE_INIT_BIT);
  }

@@ -135,7 +136,7 @@ void acl_ble_connection_fail(const tBLE_BD_ADDR& address_with_type,
  btm_acl_create_failed(address_with_type.bda, BT_TRANSPORT_LE, status);

  if (status != HCI_ERR_ADVERTISING_TIMEOUT) {
    btm_cb.ble_ctr_cb.set_connection_state_idle();
    btm_sec_cb.ble_ctr_cb.set_connection_state_idle();
    btm_ble_clear_topology_mask(BTM_BLE_STATE_INIT_BIT);
    tBLE_BD_ADDR resolved_address_with_type;
    maybe_resolve_received_address(address_with_type,
@@ -150,7 +151,7 @@ void acl_ble_connection_fail(const tBLE_BD_ADDR& address_with_type,
             ADDRESS_TO_LOGGABLE_CSTR(resolved_address_with_type.bda),
             hci_status_code_text(status).c_str());
  } else {
    btm_cb.ble_ctr_cb.inq_var.adv_mode = BTM_BLE_ADV_DISABLE;
    btm_sec_cb.ble_ctr_cb.inq_var.adv_mode = BTM_BLE_ADV_DISABLE;
  }
  btm_ble_update_mode_operation(HCI_ROLE_UNKNOWN, &address_with_type.bda,
                                status);
Loading