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

Commit 20878cbe 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 am: 183e5cb0 am: 5227d80b

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

Change-Id: I36c66e3a42712afecd3f52e2f3418c66f301ac2b
parents bc070194 5227d80b
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -58,18 +58,20 @@ class LeInitiatorAddressFacadeService : public LeInitiatorAddressFacade::Service
      ASSERT(Address::FromString(request->address_with_type().address().address(), address));
      ASSERT(Address::FromString(request->address_with_type().address().address(), address));
    }
    }
    AddressWithType address_with_type(address, static_cast<AddressType>(request->address_with_type().type()));
    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 = {};
    crypto_toolbox::Octet16 irk = {};
    auto request_irk_length = request->rotation_irk().end() - request->rotation_irk().begin();
    auto request_irk_length = request->rotation_irk().end() - request->rotation_irk().begin();
    if (request_irk_length == crypto_toolbox::OCTET16_LEN) {
    if (request_irk_length == crypto_toolbox::OCTET16_LEN) {
      std::vector<uint8_t> irk_data(request->rotation_irk().begin(), request->rotation_irk().end());
      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());
      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 {
    } 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(
      acl_manager_->SetPrivacyPolicyForInitiatorAddress(
          address_policy, address_with_type, minimum_rotation_time, maximum_rotation_time);
          address_policy, address_with_type, minimum_rotation_time, maximum_rotation_time);
      ASSERT(request_irk_length == 0);
    }
    return ::grpc::Status::OK;
    return ::grpc::Status::OK;
  }
  }