Loading system/gd/hci/le_address_manager.cc +16 −5 Original line number Diff line number Diff line Loading @@ -267,7 +267,7 @@ void LeAddressManager::set_random_address() { } auto packet = hci::LeSetRandomAddressBuilder::Create(address); enqueue_command_.Run(std::move(packet)); le_address_ = AddressWithType(address, AddressType::RANDOM_DEVICE_ADDRESS); cached_address_ = AddressWithType(address, AddressType::RANDOM_DEVICE_ADDRESS); } void LeAddressManager::rotate_random_address() { Loading Loading @@ -422,11 +422,22 @@ void LeAddressManager::OnCommandComplete(bluetooth::hci::CommandCompleteView vie LOG_INFO("Received command complete with op_code %s", op_code.c_str()); // The command was sent before any client registered, we can make sure all the clients paused when command complete. if (view.GetCommandOpCode() == OpCode::LE_SET_RANDOM_ADDRESS && address_policy_ == AddressPolicy::USE_STATIC_ADDRESS) { if (view.GetCommandOpCode() == OpCode::LE_SET_RANDOM_ADDRESS) { if (address_policy_ == AddressPolicy::USE_STATIC_ADDRESS) { LOG_INFO("Received LE_SET_RANDOM_ADDRESS complete and Address policy is USE_STATIC_ADDRESS, return"); return; } auto complete_view = LeSetRandomAddressCompleteView::Create(view); if (!complete_view.IsValid()) { LOG_ERROR("Received LE_SET_RANDOM_ADDRESS complete with invalid packet"); } else if (complete_view.IsValid() && complete_view.GetStatus() != ErrorCode::SUCCESS) { LOG_ERROR( "Received LE_SET_RANDOM_ADDRESS complete with status %s", ErrorCodeText(complete_view.GetStatus()).c_str()); } else { LOG_INFO("update random address : %s", cached_address_.GetAddress().ToString().c_str()); le_address_ = cached_address_; } } if (cached_commands_.empty()) { handler_->BindOnceOn(this, &LeAddressManager::resume_registered_clients).Invoke(); Loading system/gd/hci/le_address_manager.h +1 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,7 @@ class LeAddressManager { AddressPolicy address_policy_ = AddressPolicy::POLICY_NOT_SET; AddressWithType le_address_; AddressWithType cached_address_; Address public_address_; std::unique_ptr<os::Alarm> address_rotation_alarm_; crypto_toolbox::Octet16 rotation_irk_; Loading Loading
system/gd/hci/le_address_manager.cc +16 −5 Original line number Diff line number Diff line Loading @@ -267,7 +267,7 @@ void LeAddressManager::set_random_address() { } auto packet = hci::LeSetRandomAddressBuilder::Create(address); enqueue_command_.Run(std::move(packet)); le_address_ = AddressWithType(address, AddressType::RANDOM_DEVICE_ADDRESS); cached_address_ = AddressWithType(address, AddressType::RANDOM_DEVICE_ADDRESS); } void LeAddressManager::rotate_random_address() { Loading Loading @@ -422,11 +422,22 @@ void LeAddressManager::OnCommandComplete(bluetooth::hci::CommandCompleteView vie LOG_INFO("Received command complete with op_code %s", op_code.c_str()); // The command was sent before any client registered, we can make sure all the clients paused when command complete. if (view.GetCommandOpCode() == OpCode::LE_SET_RANDOM_ADDRESS && address_policy_ == AddressPolicy::USE_STATIC_ADDRESS) { if (view.GetCommandOpCode() == OpCode::LE_SET_RANDOM_ADDRESS) { if (address_policy_ == AddressPolicy::USE_STATIC_ADDRESS) { LOG_INFO("Received LE_SET_RANDOM_ADDRESS complete and Address policy is USE_STATIC_ADDRESS, return"); return; } auto complete_view = LeSetRandomAddressCompleteView::Create(view); if (!complete_view.IsValid()) { LOG_ERROR("Received LE_SET_RANDOM_ADDRESS complete with invalid packet"); } else if (complete_view.IsValid() && complete_view.GetStatus() != ErrorCode::SUCCESS) { LOG_ERROR( "Received LE_SET_RANDOM_ADDRESS complete with status %s", ErrorCodeText(complete_view.GetStatus()).c_str()); } else { LOG_INFO("update random address : %s", cached_address_.GetAddress().ToString().c_str()); le_address_ = cached_address_; } } if (cached_commands_.empty()) { handler_->BindOnceOn(this, &LeAddressManager::resume_registered_clients).Invoke(); Loading
system/gd/hci/le_address_manager.h +1 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,7 @@ class LeAddressManager { AddressPolicy address_policy_ = AddressPolicy::POLICY_NOT_SET; AddressWithType le_address_; AddressWithType cached_address_; Address public_address_; std::unique_ptr<os::Alarm> address_rotation_alarm_; crypto_toolbox::Octet16 rotation_irk_; Loading