Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +1 −1 Original line number Diff line number Diff line Loading @@ -5089,7 +5089,7 @@ public class AdapterService extends Service { initFlags.add(String.format("%s=%s", GD_LINK_POLICY_FLAG, "true")); } if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_BLUETOOTH, GATT_ROBUST_CACHING_CLIENT_FLAG, false)) { GATT_ROBUST_CACHING_CLIENT_FLAG, true)) { initFlags.add(String.format("%s=%s", GATT_ROBUST_CACHING_CLIENT_FLAG, "true")); } if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_BLUETOOTH, Loading system/bta/dm/bta_dm_act.cc +16 −6 Original line number Diff line number Diff line Loading @@ -966,7 +966,7 @@ static bool bta_dm_read_remote_device_name(const RawAddress& bd_addr, /* Remote name discovery is on going now so BTM cannot notify through * "bta_dm_remname_cback" */ /* adding callback to get notified that current reading remore name done */ /* adding callback to get notified that current reading remote name done */ if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecAddRmtNameNotifyCallback( Loading Loading @@ -1881,6 +1881,7 @@ static void bta_dm_service_search_remname_cback(const RawAddress& bd_addr, /* if this is what we are looking for */ if (bta_dm_search_cb.peer_bdaddr == bd_addr) { rem_name.bd_addr = bd_addr; rem_name.length = strlcpy((char*)rem_name.remote_bd_name, (char*)bd_name, BD_NAME_LEN + 1); if (rem_name.length > BD_NAME_LEN) { Loading @@ -1902,6 +1903,9 @@ static void bta_dm_service_search_remname_cback(const RawAddress& bd_addr, APPL_TRACE_WARNING("%s: BTM_ReadRemoteDeviceName returns 0x%02X", __func__, btm_status); // needed so our response is not ignored, since this corresponds to the // actual peer_bdaddr rem_name.bd_addr = bta_dm_search_cb.peer_bdaddr; rem_name.length = 0; rem_name.remote_bd_name[0] = 0; rem_name.status = btm_status; Loading @@ -1924,11 +1928,6 @@ static void bta_dm_remname_cback(void* p) { APPL_TRACE_DEBUG("bta_dm_remname_cback len = %d name=<%s>", p_remote_name->length, p_remote_name->remote_bd_name); /* remote name discovery is done but it could be failed */ bta_dm_search_cb.name_discover_done = true; strlcpy((char*)bta_dm_search_cb.peer_name, (char*)p_remote_name->remote_bd_name, BD_NAME_LEN + 1); if (bta_dm_search_cb.peer_bdaddr == p_remote_name->bd_addr) { if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecDeleteRmtNameNotifyCallback( Loading @@ -1936,8 +1935,19 @@ static void bta_dm_remname_cback(void* p) { } else { BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); } } else { // if we got a different response, ignore it // we will have made a request directly from BTM_ReadRemoteDeviceName so we // expect a dedicated response for us LOG_INFO("ignoring remote name response in DM callback since it's for the wrong bd_addr"); return; } /* remote name discovery is done but it could be failed */ bta_dm_search_cb.name_discover_done = true; strlcpy((char*)bta_dm_search_cb.peer_name, (char*)p_remote_name->remote_bd_name, BD_NAME_LEN + 1); if (bta_dm_search_cb.transport == BT_TRANSPORT_LE) { GAP_BleReadPeerPrefConnParams(bta_dm_search_cb.peer_bdaddr); } Loading system/bta/gatt/bta_gattc_act.cc +2 −5 Original line number Diff line number Diff line Loading @@ -536,12 +536,9 @@ void bta_gattc_conn(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data) { p_clcb->p_srcb->state != BTA_GATTC_SERV_IDLE) { if (p_clcb->p_srcb->state == BTA_GATTC_SERV_IDLE) { p_clcb->p_srcb->state = BTA_GATTC_SERV_LOAD; // Consider the case that if GATT Server is changed, but no service // changed indication is received, the database might be out of date. So // if robust caching is enabled, any time when connection is established, // always check the db hash first, not just load the stored database. // For bonded devices, read cache directly, and back to connected state. gatt::Database db = bta_gattc_cache_load(p_clcb->p_srcb->server_bda); if (!bta_gattc_is_robust_caching_enabled() && !db.IsEmpty()) { if (!db.IsEmpty() && btm_sec_is_a_bonded_dev(p_clcb->p_srcb->server_bda)) { p_clcb->p_srcb->gatt_database = db; p_clcb->p_srcb->state = BTA_GATTC_SERV_IDLE; bta_gattc_reset_discover_st(p_clcb->p_srcb, GATT_SUCCESS); Loading system/gd/hci/acl_manager/le_impl.h +6 −1 Original line number Diff line number Diff line Loading @@ -647,7 +647,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { return; } if (connect_list.empty()) { LOG_ERROR("Attempting to re-arm le connection state machine when filter accept list is empty"); LOG_INFO("Ignored request to re-arm le connection state machine when filter accept list is empty"); return; } AddressWithType empty(Address::kEmpty, AddressType::RANDOM_DEVICE_ADDRESS); Loading Loading @@ -847,6 +847,11 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { } void cancel_connect(AddressWithType address_with_type) { // Remove any alarms for this peer, if any if (create_connection_timeout_alarms_.find(address_with_type) != create_connection_timeout_alarms_.end()) { create_connection_timeout_alarms_.at(address_with_type).Cancel(); create_connection_timeout_alarms_.erase(address_with_type); } // the connection will be canceled by LeAddressManager.OnPause() remove_device_from_connect_list(address_with_type); } Loading system/gd/hci/le_advertising_manager.cc +5 −3 Original line number Diff line number Diff line Loading @@ -318,9 +318,11 @@ struct LeAdvertisingManager::impl : public bluetooth::hci::LeAddressManagerCallb set_data(id, true, config.scan_response); } set_data(id, false, config.advertisement); if (address_policy != LeAddressManager::AddressPolicy::USE_PUBLIC_ADDRESS) { le_advertising_interface_->EnqueueCommand( hci::LeMultiAdvtSetRandomAddrBuilder::Create(advertising_sets_[id].current_address.GetAddress(), id), module_handler_->BindOnce(impl::check_status<LeMultiAdvtCompleteView>)); } if (!paused) { enable_advertiser(id, true, 0, 0); } else { Loading Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +1 −1 Original line number Diff line number Diff line Loading @@ -5089,7 +5089,7 @@ public class AdapterService extends Service { initFlags.add(String.format("%s=%s", GD_LINK_POLICY_FLAG, "true")); } if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_BLUETOOTH, GATT_ROBUST_CACHING_CLIENT_FLAG, false)) { GATT_ROBUST_CACHING_CLIENT_FLAG, true)) { initFlags.add(String.format("%s=%s", GATT_ROBUST_CACHING_CLIENT_FLAG, "true")); } if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_BLUETOOTH, Loading
system/bta/dm/bta_dm_act.cc +16 −6 Original line number Diff line number Diff line Loading @@ -966,7 +966,7 @@ static bool bta_dm_read_remote_device_name(const RawAddress& bd_addr, /* Remote name discovery is on going now so BTM cannot notify through * "bta_dm_remname_cback" */ /* adding callback to get notified that current reading remore name done */ /* adding callback to get notified that current reading remote name done */ if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecAddRmtNameNotifyCallback( Loading Loading @@ -1881,6 +1881,7 @@ static void bta_dm_service_search_remname_cback(const RawAddress& bd_addr, /* if this is what we are looking for */ if (bta_dm_search_cb.peer_bdaddr == bd_addr) { rem_name.bd_addr = bd_addr; rem_name.length = strlcpy((char*)rem_name.remote_bd_name, (char*)bd_name, BD_NAME_LEN + 1); if (rem_name.length > BD_NAME_LEN) { Loading @@ -1902,6 +1903,9 @@ static void bta_dm_service_search_remname_cback(const RawAddress& bd_addr, APPL_TRACE_WARNING("%s: BTM_ReadRemoteDeviceName returns 0x%02X", __func__, btm_status); // needed so our response is not ignored, since this corresponds to the // actual peer_bdaddr rem_name.bd_addr = bta_dm_search_cb.peer_bdaddr; rem_name.length = 0; rem_name.remote_bd_name[0] = 0; rem_name.status = btm_status; Loading @@ -1924,11 +1928,6 @@ static void bta_dm_remname_cback(void* p) { APPL_TRACE_DEBUG("bta_dm_remname_cback len = %d name=<%s>", p_remote_name->length, p_remote_name->remote_bd_name); /* remote name discovery is done but it could be failed */ bta_dm_search_cb.name_discover_done = true; strlcpy((char*)bta_dm_search_cb.peer_name, (char*)p_remote_name->remote_bd_name, BD_NAME_LEN + 1); if (bta_dm_search_cb.peer_bdaddr == p_remote_name->bd_addr) { if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecDeleteRmtNameNotifyCallback( Loading @@ -1936,8 +1935,19 @@ static void bta_dm_remname_cback(void* p) { } else { BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); } } else { // if we got a different response, ignore it // we will have made a request directly from BTM_ReadRemoteDeviceName so we // expect a dedicated response for us LOG_INFO("ignoring remote name response in DM callback since it's for the wrong bd_addr"); return; } /* remote name discovery is done but it could be failed */ bta_dm_search_cb.name_discover_done = true; strlcpy((char*)bta_dm_search_cb.peer_name, (char*)p_remote_name->remote_bd_name, BD_NAME_LEN + 1); if (bta_dm_search_cb.transport == BT_TRANSPORT_LE) { GAP_BleReadPeerPrefConnParams(bta_dm_search_cb.peer_bdaddr); } Loading
system/bta/gatt/bta_gattc_act.cc +2 −5 Original line number Diff line number Diff line Loading @@ -536,12 +536,9 @@ void bta_gattc_conn(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data) { p_clcb->p_srcb->state != BTA_GATTC_SERV_IDLE) { if (p_clcb->p_srcb->state == BTA_GATTC_SERV_IDLE) { p_clcb->p_srcb->state = BTA_GATTC_SERV_LOAD; // Consider the case that if GATT Server is changed, but no service // changed indication is received, the database might be out of date. So // if robust caching is enabled, any time when connection is established, // always check the db hash first, not just load the stored database. // For bonded devices, read cache directly, and back to connected state. gatt::Database db = bta_gattc_cache_load(p_clcb->p_srcb->server_bda); if (!bta_gattc_is_robust_caching_enabled() && !db.IsEmpty()) { if (!db.IsEmpty() && btm_sec_is_a_bonded_dev(p_clcb->p_srcb->server_bda)) { p_clcb->p_srcb->gatt_database = db; p_clcb->p_srcb->state = BTA_GATTC_SERV_IDLE; bta_gattc_reset_discover_st(p_clcb->p_srcb, GATT_SUCCESS); Loading
system/gd/hci/acl_manager/le_impl.h +6 −1 Original line number Diff line number Diff line Loading @@ -647,7 +647,7 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { return; } if (connect_list.empty()) { LOG_ERROR("Attempting to re-arm le connection state machine when filter accept list is empty"); LOG_INFO("Ignored request to re-arm le connection state machine when filter accept list is empty"); return; } AddressWithType empty(Address::kEmpty, AddressType::RANDOM_DEVICE_ADDRESS); Loading Loading @@ -847,6 +847,11 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback { } void cancel_connect(AddressWithType address_with_type) { // Remove any alarms for this peer, if any if (create_connection_timeout_alarms_.find(address_with_type) != create_connection_timeout_alarms_.end()) { create_connection_timeout_alarms_.at(address_with_type).Cancel(); create_connection_timeout_alarms_.erase(address_with_type); } // the connection will be canceled by LeAddressManager.OnPause() remove_device_from_connect_list(address_with_type); } Loading
system/gd/hci/le_advertising_manager.cc +5 −3 Original line number Diff line number Diff line Loading @@ -318,9 +318,11 @@ struct LeAdvertisingManager::impl : public bluetooth::hci::LeAddressManagerCallb set_data(id, true, config.scan_response); } set_data(id, false, config.advertisement); if (address_policy != LeAddressManager::AddressPolicy::USE_PUBLIC_ADDRESS) { le_advertising_interface_->EnqueueCommand( hci::LeMultiAdvtSetRandomAddrBuilder::Create(advertising_sets_[id].current_address.GetAddress(), id), module_handler_->BindOnce(impl::check_status<LeMultiAdvtCompleteView>)); } if (!paused) { enable_advertiser(id, true, 0, 0); } else { Loading