} else if (
address_policy_ == AddressPolicy::USE_RESOLVABLE_ADDRESS ||
address_policy_ == AddressPolicy::USE_NON_RESOLVABLE_ADDRESS) {
- if (bluetooth::common::init_flags::gd_acl_is_enabled()) {
+ if (bluetooth::common::init_flags::gd_acl_is_enabled() || bluetooth::common::init_flags::gd_l2cap_is_enabled()) {
if (registered_clients_.size() == 1) {
schedule_rotate_random_address();
}
#include <cstddef>
#include <cstdint>
+#include "gd/hci/acl_manager.h"
#include "main/shim/acl_api.h"
#include "main/shim/helpers.h"
#include "main/shim/stack.h"
}
void bluetooth::shim::ACL_ConfigureLePrivacy(bool is_le_privacy_enabled) {
- Stack::GetInstance()->GetAcl()->ConfigureLePrivacy(is_le_privacy_enabled);
+ hci::LeAddressManager::AddressPolicy address_policy =
+ is_le_privacy_enabled
+ ? hci::LeAddressManager::AddressPolicy::USE_RESOLVABLE_ADDRESS
+ : hci::LeAddressManager::AddressPolicy::USE_PUBLIC_ADDRESS;
+ hci::AddressWithType empty_address_with_type(
+ hci::Address{}, hci::AddressType::RANDOM_DEVICE_ADDRESS);
+ /* 7 minutes minimum, 15 minutes maximum for random address refreshing */
+ auto minimum_rotation_time = std::chrono::minutes(7);
+ auto maximum_rotation_time = std::chrono::minutes(15);
+
+ Stack::GetInstance()
+ ->GetStackManager()
+ ->GetInstance<bluetooth::hci::AclManager>()
+ ->SetPrivacyPolicyForInitiatorAddress(
+ address_policy, empty_address_with_type, minimum_rotation_time,
+ maximum_rotation_time);
}
void bluetooth::shim::ACL_Disconnect(uint16_t handle, bool is_classic,
GAP_BleAttrDBUpdate(GATT_UUID_GAP_CENTRAL_ADDR_RESOL, &gap_ble_attr_value);
- if (bluetooth::shim::is_gd_acl_enabled()) {
+ if (bluetooth::shim::is_gd_acl_enabled() ||
+ bluetooth::shim::is_gd_l2cap_enabled()) {
bluetooth::shim::ACL_ConfigureLePrivacy(privacy_mode);
}
return true;