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

Commit 183e5cb0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Call the 'ForTest' function to pass proper IRK" am: 4a31a3bf

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2015855

Change-Id: I5fe572c68b6b02403ff9422dec083f7bbee6a82e
parents ebb6158d 4a31a3bf
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -58,18 +58,20 @@ class LeInitiatorAddressFacadeService : public LeInitiatorAddressFacade::Service
      ASSERT(Address::FromString(request->address_with_type().address().address(), address));
    }
    AddressWithType address_with_type(address, static_cast<AddressType>(request->address_with_type().type()));
    auto minimum_rotation_time = std::chrono::milliseconds(request->minimum_rotation_time());
    auto maximum_rotation_time = std::chrono::milliseconds(request->maximum_rotation_time());
    crypto_toolbox::Octet16 irk = {};
    auto request_irk_length = request->rotation_irk().end() - request->rotation_irk().begin();
    if (request_irk_length == crypto_toolbox::OCTET16_LEN) {
      std::vector<uint8_t> irk_data(request->rotation_irk().begin(), request->rotation_irk().end());
      std::copy_n(irk_data.begin(), crypto_toolbox::OCTET16_LEN, irk.begin());
      acl_manager_->SetPrivacyPolicyForInitiatorAddressForTest(
          address_policy, address_with_type, irk, minimum_rotation_time, maximum_rotation_time);
    } else {
      ASSERT(request_irk_length == 0);
    }
    auto minimum_rotation_time = std::chrono::milliseconds(request->minimum_rotation_time());
    auto maximum_rotation_time = std::chrono::milliseconds(request->maximum_rotation_time());
      acl_manager_->SetPrivacyPolicyForInitiatorAddress(
          address_policy, address_with_type, minimum_rotation_time, maximum_rotation_time);
      ASSERT(request_irk_length == 0);
    }
    return ::grpc::Status::OK;
  }