Loading system/gd/hci/le_address_manager.cc +12 −3 Original line number Diff line number Diff line Loading @@ -411,8 +411,12 @@ void LeAddressManager::AddDeviceToResolvingList( Command enable = {CommandType::SET_ADDRESS_RESOLUTION_ENABLE, std::move(enable_builder)}; cached_commands_.push(std::move(enable)); if (registered_clients_.empty()) { handle_next_command(); } else { pause_registered_clients(); } } void LeAddressManager::RemoveDeviceFromConnectList( ConnectListAddressType connect_list_address_type, bluetooth::hci::Address address) { Loading @@ -438,8 +442,12 @@ void LeAddressManager::RemoveDeviceFromResolvingList( Command enable = {CommandType::SET_ADDRESS_RESOLUTION_ENABLE, std::move(enable_builder)}; cached_commands_.push(std::move(enable)); if (registered_clients_.empty()) { handle_next_command(); } else { pause_registered_clients(); } } void LeAddressManager::ClearConnectList() { auto packet_builder = hci::LeClearConnectListBuilder::Create(); Loading Loading @@ -496,7 +504,8 @@ void LeAddressManager::OnCommandComplete(bluetooth::hci::CommandCompleteView vie void LeAddressManager::check_cached_commands() { for (auto client : registered_clients_) { if (client.second != ClientState::PAUSED) { if (client.second != ClientState::PAUSED && !cached_commands_.empty()) { pause_registered_clients(); return; } } Loading system/gd/hci/le_scanning_callback.h +1 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ class AdvertisingPacketContentFilterCommand { uint16_t company_mask; std::vector<uint8_t> data; std::vector<uint8_t> data_mask; std::array<uint8_t, 16> irk; }; class AdvertisingFilterParameter { Loading system/gd/hci/le_scanning_manager.cc +37 −3 Original line number Diff line number Diff line Loading @@ -712,7 +712,7 @@ struct LeScanningManager::impl : public bluetooth::hci::LeAddressManagerCallback switch (filter.filter_type) { case ApcfFilterType::BROADCASTER_ADDRESS: { update_address_filter(apcf_action, filter_index, filter.address, filter.application_address_type); update_address_filter(apcf_action, filter_index, filter.address, filter.application_address_type, filter.irk); break; } case ApcfFilterType::SERVICE_UUID: Loading Loading @@ -741,11 +741,36 @@ struct LeScanningManager::impl : public bluetooth::hci::LeAddressManagerCallback } void update_address_filter( ApcfAction action, uint8_t filter_index, Address address, ApcfApplicationAddressType address_type) { ApcfAction action, uint8_t filter_index, Address address, ApcfApplicationAddressType address_type, std::array<uint8_t, 16> irk) { if (action != ApcfAction::CLEAR) { /* * The vendor command (APCF Filtering 0x0157) takes Public (0) or Random (1) * or Addresses type not applicable (2). * * Advertising results have four types: *  - Public = 0 *  - Random = 1 *  - Public ID = 2 *  - Random ID = 3 * * e.g. specifying PUBLIC (0) will only return results with a public * address. It will ignore resolved addresses, since they return PUBLIC * IDENTITY (2). For this, Addresses type not applicable (0x02) must be specified. * This should also cover if the RPA is derived from RANDOM STATIC. */ le_scanning_interface_->EnqueueCommand( LeAdvFilterBroadcasterAddressBuilder::Create(action, filter_index, address, address_type), LeAdvFilterBroadcasterAddressBuilder::Create( action, filter_index, address, ApcfApplicationAddressType::NOT_APPLICABLE), module_handler_->BindOnceOn(this, &impl::on_advertising_filter_complete)); if (!is_empty_128bit(irk)) { std::array<uint8_t, 16> empty_irk; le_address_manager_->AddDeviceToResolvingList( static_cast<PeerAddressType>(address_type), address, irk, empty_irk); } } else { le_scanning_interface_->EnqueueCommand( LeAdvFilterClearBroadcasterAddressBuilder::Create(filter_index), Loading @@ -753,6 +778,15 @@ struct LeScanningManager::impl : public bluetooth::hci::LeAddressManagerCallback } } bool is_empty_128bit(const std::array<uint8_t, 16> data) { for (int i = 0; i < 16; i++) { if (data[i] != (uint8_t)0) { return false; } } return true; } void update_uuid_filter( ApcfAction action, uint8_t filter_index, ApcfFilterType filter_type, Uuid uuid, Uuid uuid_mask) { std::vector<uint8_t> combined_data = {}; Loading system/main/shim/le_scanning_manager.cc +1 −0 Original line number Diff line number Diff line Loading @@ -491,6 +491,7 @@ bool BleScannerInterfaceImpl::parse_filter_command( apcf_command.data.begin(), apcf_command.data.end()); advertising_packet_content_filter_command.data_mask.assign( apcf_command.data_mask.begin(), apcf_command.data_mask.end()); advertising_packet_content_filter_command.irk = apcf_command.irk; return true; } Loading Loading
system/gd/hci/le_address_manager.cc +12 −3 Original line number Diff line number Diff line Loading @@ -411,8 +411,12 @@ void LeAddressManager::AddDeviceToResolvingList( Command enable = {CommandType::SET_ADDRESS_RESOLUTION_ENABLE, std::move(enable_builder)}; cached_commands_.push(std::move(enable)); if (registered_clients_.empty()) { handle_next_command(); } else { pause_registered_clients(); } } void LeAddressManager::RemoveDeviceFromConnectList( ConnectListAddressType connect_list_address_type, bluetooth::hci::Address address) { Loading @@ -438,8 +442,12 @@ void LeAddressManager::RemoveDeviceFromResolvingList( Command enable = {CommandType::SET_ADDRESS_RESOLUTION_ENABLE, std::move(enable_builder)}; cached_commands_.push(std::move(enable)); if (registered_clients_.empty()) { handle_next_command(); } else { pause_registered_clients(); } } void LeAddressManager::ClearConnectList() { auto packet_builder = hci::LeClearConnectListBuilder::Create(); Loading Loading @@ -496,7 +504,8 @@ void LeAddressManager::OnCommandComplete(bluetooth::hci::CommandCompleteView vie void LeAddressManager::check_cached_commands() { for (auto client : registered_clients_) { if (client.second != ClientState::PAUSED) { if (client.second != ClientState::PAUSED && !cached_commands_.empty()) { pause_registered_clients(); return; } } Loading
system/gd/hci/le_scanning_callback.h +1 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ class AdvertisingPacketContentFilterCommand { uint16_t company_mask; std::vector<uint8_t> data; std::vector<uint8_t> data_mask; std::array<uint8_t, 16> irk; }; class AdvertisingFilterParameter { Loading
system/gd/hci/le_scanning_manager.cc +37 −3 Original line number Diff line number Diff line Loading @@ -712,7 +712,7 @@ struct LeScanningManager::impl : public bluetooth::hci::LeAddressManagerCallback switch (filter.filter_type) { case ApcfFilterType::BROADCASTER_ADDRESS: { update_address_filter(apcf_action, filter_index, filter.address, filter.application_address_type); update_address_filter(apcf_action, filter_index, filter.address, filter.application_address_type, filter.irk); break; } case ApcfFilterType::SERVICE_UUID: Loading Loading @@ -741,11 +741,36 @@ struct LeScanningManager::impl : public bluetooth::hci::LeAddressManagerCallback } void update_address_filter( ApcfAction action, uint8_t filter_index, Address address, ApcfApplicationAddressType address_type) { ApcfAction action, uint8_t filter_index, Address address, ApcfApplicationAddressType address_type, std::array<uint8_t, 16> irk) { if (action != ApcfAction::CLEAR) { /* * The vendor command (APCF Filtering 0x0157) takes Public (0) or Random (1) * or Addresses type not applicable (2). * * Advertising results have four types: *  - Public = 0 *  - Random = 1 *  - Public ID = 2 *  - Random ID = 3 * * e.g. specifying PUBLIC (0) will only return results with a public * address. It will ignore resolved addresses, since they return PUBLIC * IDENTITY (2). For this, Addresses type not applicable (0x02) must be specified. * This should also cover if the RPA is derived from RANDOM STATIC. */ le_scanning_interface_->EnqueueCommand( LeAdvFilterBroadcasterAddressBuilder::Create(action, filter_index, address, address_type), LeAdvFilterBroadcasterAddressBuilder::Create( action, filter_index, address, ApcfApplicationAddressType::NOT_APPLICABLE), module_handler_->BindOnceOn(this, &impl::on_advertising_filter_complete)); if (!is_empty_128bit(irk)) { std::array<uint8_t, 16> empty_irk; le_address_manager_->AddDeviceToResolvingList( static_cast<PeerAddressType>(address_type), address, irk, empty_irk); } } else { le_scanning_interface_->EnqueueCommand( LeAdvFilterClearBroadcasterAddressBuilder::Create(filter_index), Loading @@ -753,6 +778,15 @@ struct LeScanningManager::impl : public bluetooth::hci::LeAddressManagerCallback } } bool is_empty_128bit(const std::array<uint8_t, 16> data) { for (int i = 0; i < 16; i++) { if (data[i] != (uint8_t)0) { return false; } } return true; } void update_uuid_filter( ApcfAction action, uint8_t filter_index, ApcfFilterType filter_type, Uuid uuid, Uuid uuid_mask) { std::vector<uint8_t> combined_data = {}; Loading
system/main/shim/le_scanning_manager.cc +1 −0 Original line number Diff line number Diff line Loading @@ -491,6 +491,7 @@ bool BleScannerInterfaceImpl::parse_filter_command( apcf_command.data.begin(), apcf_command.data.end()); advertising_packet_content_filter_command.data_mask.assign( apcf_command.data_mask.begin(), apcf_command.data_mask.end()); advertising_packet_content_filter_command.irk = apcf_command.irk; return true; } Loading