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

Commit e9b7d1d0 authored by Sophie Hu's avatar Sophie Hu
Browse files

Set all-zero of peer address, peer address type, and peer IRK in resolving list for RPA offload

Bug: 378398874
Bug: 378143579
Test: mm packages/modules/Bluetooth
Test: test with vendor test firmware b/331772841
Flag: com.android.bluetooth.flags.rpa_offload_to_bt_controller
Change-Id: I1dcb197f263fce9266dfdf802ec4d16f1e2dc613
parent 2f4fbbec
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@
#include "hci/le_rand_callback.h"
#include "internal_include/bt_target.h"
#include "internal_include/stack_config.h"
#include "main/shim/acl_api.h"
#include "main/shim/entry.h"
#include "main/shim/helpers.h"
#include "main/shim/le_advertising_manager.h"
@@ -1967,6 +1968,22 @@ void BTIF_dm_enable() {
  pairing_cb = {};
  pairing_cb.bond_type = BOND_TYPE_PERSISTENT;

  /* Bluetooth Core Specification version 5.4
   *   7.8.5 LE Set Advertising Parameters command
   *   7.8.53 LE Set Extended Advertising Parameters command
   *   7.8.64 LE Set Extended Scan Parameters command
   *   7.8.12 LE Create Connection command
   *   7.8.66 LE Extended Create Connection command
   * Set all-zero set to resolving list to make controller generate RPA for
   * un-direct (broadcast) advertising RPA */
  if (bluetooth::shim::GetController()->IsRpaGenerationSupported()) {
    log::info("Support RPA offload, set all-zero set in resolving list");
    tBLE_BD_ADDR all_zero_address_with_type = {0};
    const Octet16 all_zero_peer_irk = {0};
    bluetooth::shim::ACL_AddToAddressResolution(all_zero_address_with_type, all_zero_peer_irk,
                                                ble_local_key_cb.id_keys.irk);
  }

  // Enable address consolidation.
  btif_storage_load_le_devices();

+1 −1
Original line number Diff line number Diff line
@@ -857,7 +857,7 @@ public:
      address_with_type = AddressWithType();
    }

    if (controller_->IsRpaOffloadSupported() &&
    if (controller_->IsRpaGenerationSupported() &&
        own_address_type != OwnAddressType::PUBLIC_DEVICE_ADDRESS) {
      log::info("Support RPA offload, set own address type RESOLVABLE_OR_RANDOM_ADDRESS");
      own_address_type = OwnAddressType::RESOLVABLE_OR_RANDOM_ADDRESS;
+1 −1
Original line number Diff line number Diff line
@@ -1546,7 +1546,7 @@ uint64_t Controller::MaskLeEventMask(HciVersion version, uint64_t mask) {
  }
}

bool Controller::IsRpaOffloadSupported(void) {
bool Controller::IsRpaGenerationSupported(void) const {
  static const bool rpa_supported =
          com::android::bluetooth::flags::rpa_offload_to_bt_controller() &&
          os::GetSystemPropertyBool(kPropertyRpaOffload, kDefaultRpaOffload) &&
+1 −1
Original line number Diff line number Diff line
@@ -217,7 +217,7 @@ public:

  static uint64_t MaskLeEventMask(HciVersion version, uint64_t mask);

  bool IsRpaOffloadSupported(void);
  virtual bool IsRpaGenerationSupported(void) const override;

protected:
  void ListDependencies(ModuleList* list) const override;
+2 −0
Original line number Diff line number Diff line
@@ -215,6 +215,8 @@ public:
  virtual VendorCapabilities GetVendorCapabilities() const = 0;

  virtual bool IsSupported(OpCode op_code) const = 0;

  virtual bool IsRpaGenerationSupported(void) const = 0;
};

}  // namespace hci
Loading