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

Commit 3ea4d290 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "floss: Require ble privacy flag for resolving list"

parents 1d1e5b5c e2cac894
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -65,6 +65,7 @@ constexpr uint8_t PHY_LE_NO_PACKET = 0x00;
constexpr uint8_t PHY_LE_1M = 0x01;
constexpr uint8_t PHY_LE_1M = 0x01;
constexpr uint8_t PHY_LE_2M = 0x02;
constexpr uint8_t PHY_LE_2M = 0x02;
constexpr uint8_t PHY_LE_CODED = 0x04;
constexpr uint8_t PHY_LE_CODED = 0x04;
constexpr bool kEnableBlePrivacy = true;


static const std::string kPropertyMinConnInterval = "bluetooth.core.le.min_connection_interval";
static const std::string kPropertyMinConnInterval = "bluetooth.core.le.min_connection_interval";
static const std::string kPropertyMaxConnInterval = "bluetooth.core.le.max_connection_interval";
static const std::string kPropertyMaxConnInterval = "bluetooth.core.le.max_connection_interval";
@@ -77,6 +78,7 @@ static const std::string kPropertyConnScanWindow2mFast = "bluetooth.core.le.conn
static const std::string kPropertyConnScanWindowCodedFast = "bluetooth.core.le.connection_scan_window_coded_fast";
static const std::string kPropertyConnScanWindowCodedFast = "bluetooth.core.le.connection_scan_window_coded_fast";
static const std::string kPropertyConnScanIntervalSlow = "bluetooth.core.le.connection_scan_interval_slow";
static const std::string kPropertyConnScanIntervalSlow = "bluetooth.core.le.connection_scan_interval_slow";
static const std::string kPropertyConnScanWindowSlow = "bluetooth.core.le.connection_scan_window_slow";
static const std::string kPropertyConnScanWindowSlow = "bluetooth.core.le.connection_scan_window_slow";
static const std::string kPropertyEnableBlePrivacy = "bluetooth.core.gap.le.privacy.enabled";


enum class ConnectabilityState {
enum class ConnectabilityState {
  DISARMED = 0,
  DISARMED = 0,
@@ -996,7 +998,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback {
        address_policy,
        address_policy,
        fixed_address,
        fixed_address,
        rotation_irk,
        rotation_irk,
        controller_->SupportsBlePrivacy(),
        controller_->SupportsBlePrivacy() && os::GetSystemPropertyBool(kPropertyEnableBlePrivacy, kEnableBlePrivacy),
        minimum_rotation_time,
        minimum_rotation_time,
        maximum_rotation_time);
        maximum_rotation_time);
  }
  }
+12 −0
Original line number Original line Diff line number Diff line
@@ -435,6 +435,10 @@ void LeAddressManager::AddDeviceToResolvingList(
    Address peer_identity_address,
    Address peer_identity_address,
    const std::array<uint8_t, 16>& peer_irk,
    const std::array<uint8_t, 16>& peer_irk,
    const std::array<uint8_t, 16>& local_irk) {
    const std::array<uint8_t, 16>& local_irk) {
  if (!supports_ble_privacy_) {
    return;
  }

  // Disable Address resolution
  // Disable Address resolution
  auto disable_builder = hci::LeSetAddressResolutionEnableBuilder::Create(hci::Enable::DISABLED);
  auto disable_builder = hci::LeSetAddressResolutionEnableBuilder::Create(hci::Enable::DISABLED);
  Command disable = {CommandType::SET_ADDRESS_RESOLUTION_ENABLE, std::move(disable_builder)};
  Command disable = {CommandType::SET_ADDRESS_RESOLUTION_ENABLE, std::move(disable_builder)};
@@ -473,6 +477,10 @@ void LeAddressManager::RemoveDeviceFromFilterAcceptList(


void LeAddressManager::RemoveDeviceFromResolvingList(
void LeAddressManager::RemoveDeviceFromResolvingList(
    PeerAddressType peer_identity_address_type, Address peer_identity_address) {
    PeerAddressType peer_identity_address_type, Address peer_identity_address) {
  if (!supports_ble_privacy_) {
    return;
  }

  // Disable Address resolution
  // Disable Address resolution
  auto disable_builder = hci::LeSetAddressResolutionEnableBuilder::Create(hci::Enable::DISABLED);
  auto disable_builder = hci::LeSetAddressResolutionEnableBuilder::Create(hci::Enable::DISABLED);
  Command disable = {CommandType::SET_ADDRESS_RESOLUTION_ENABLE, std::move(disable_builder)};
  Command disable = {CommandType::SET_ADDRESS_RESOLUTION_ENABLE, std::move(disable_builder)};
@@ -502,6 +510,10 @@ void LeAddressManager::ClearFilterAcceptList() {
}
}


void LeAddressManager::ClearResolvingList() {
void LeAddressManager::ClearResolvingList() {
  if (!supports_ble_privacy_) {
    return;
  }

  // Disable Address resolution
  // Disable Address resolution
  auto disable_builder = hci::LeSetAddressResolutionEnableBuilder::Create(hci::Enable::DISABLED);
  auto disable_builder = hci::LeSetAddressResolutionEnableBuilder::Create(hci::Enable::DISABLED);
  Command disable = {CommandType::SET_ADDRESS_RESOLUTION_ENABLE, std::move(disable_builder)};
  Command disable = {CommandType::SET_ADDRESS_RESOLUTION_ENABLE, std::move(disable_builder)};