Ignore calls to set the address policy after it has already been set
Bug: 239792403
Bug: 237572866
Bug: 195410559
Change-Id: I92e7d482da8aa3afd9b7610fc0cf92f2c5357270
Test: system/gd/cert/run --clean --sl4a OobPairingSl4aTest
Test: system/gd/cert/run --clean --sl4a_sl4a OobPairingTest
Tag: #refactor
Ignore-AOSP-First: Security fix
(cherry picked from commit 3baf1d6fa2b80197fcc278d1d29c6074065e2442)
Merged-In: I92e7d482da8aa3afd9b7610fc0cf92f2c5357270
diff --git a/system/gd/hci/le_address_manager.cc b/system/gd/hci/le_address_manager.cc
index 3271d16..9634a5e 100644
--- a/system/gd/hci/le_address_manager.cc
+++ b/system/gd/hci/le_address_manager.cc
@@ -51,14 +51,17 @@
bool supports_ble_privacy,
std::chrono::milliseconds minimum_rotation_time,
std::chrono::milliseconds maximum_rotation_time) {
- // Need to update some parameteres like IRK
- if (supports_ble_privacy && address_policy_ != AddressPolicy::POLICY_NOT_SET) {
+ // Handle repeated calls to the function
+ if (address_policy_ != AddressPolicy::POLICY_NOT_SET) {
+ // Need to update some parameteres like IRK if privacy is supported
+ if (supports_ble_privacy) {
LOG_INFO("Updating rotation parameters.");
rotation_irk_ = rotation_irk;
minimum_rotation_time_ = minimum_rotation_time;
maximum_rotation_time_ = maximum_rotation_time;
set_random_address();
- return;
+ }
+ return;
}
ASSERT(address_policy_ == AddressPolicy::POLICY_NOT_SET);
ASSERT(address_policy != AddressPolicy::POLICY_NOT_SET);