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

Commit 3baf1d6f authored by Rahul Sabnis's avatar Rahul Sabnis
Browse files

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
parent f4aa35ad
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -51,13 +51,16 @@ void LeAddressManager::SetPrivacyPolicyForInitiatorAddress(
    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;
  }
  ASSERT(address_policy_ == AddressPolicy::POLICY_NOT_SET);