diff --git a/system/bta/Android.bp b/system/bta/Android.bp index 513599ec36039ce0b36590fca4341395451dcd9d..9c887a440331d09fe572e0e12488fc32dd437abb 100644 --- a/system/bta/Android.bp +++ b/system/bta/Android.bp @@ -167,6 +167,7 @@ cc_test { test_suites: ["device-tests"], srcs: [ ":TestMockStackBtm", + ":TestMockStackSdp", ":TestCommonMockFunctions", "test/bta_hf_client_test.cc", "test/bta_dm_cust_uuid_test.cc", @@ -211,9 +212,9 @@ cc_test { test_suites: ["device-tests"], srcs: [ ":TestCommonMockFunctions", - ":TestMockDevice", - ":TestMockStack", - ":TestMockBtif", + ":TestMockDevice", + ":TestMockStack", + ":TestMockBtif", "test/bta_hf_client_security_test.cc", ], shared_libs: [ @@ -234,6 +235,7 @@ cc_test { "libbt-common", ], } + cc_test { name: "bt_host_test_bta", defaults: [ diff --git a/system/bta/hf_client/bta_hf_client_main.cc b/system/bta/hf_client/bta_hf_client_main.cc index 441e3247f4164f558c44c57ec56f9f69d26a1bbe..2533cd39c5f62d9d7b483381c51c00b5e28305af 100644 --- a/system/bta/hf_client/bta_hf_client_main.cc +++ b/system/bta/hf_client/bta_hf_client_main.cc @@ -305,6 +305,14 @@ void bta_hf_client_cb_init(tBTA_HF_CLIENT_CB* client_cb, uint16_t handle) { client_cb->enabled_hf_indicators.clear(); client_cb->peer_hf_indicators.clear(); + if (client_cb->p_disc_db) { + if (!SDP_CancelServiceSearch(client_cb->p_disc_db)) { + APPL_TRACE_WARNING("Unable to cancel SDP service discovery peer: %s", + client_cb->peer_addr.ToString().c_str()); + } + osi_free_and_reset((void**)&client_cb->p_disc_db); + } + // Memset the rest of the block // memset(client_cb, 0, sizeof(tBTA_HF_CLIENT_CB)); *client_cb = {}; diff --git a/system/bta/test/bta_dip_test.cc b/system/bta/test/bta_dip_test.cc index 3e71e2e6e1619068c32d4daa0d71b960064d0f9b..d1f985e9e364666fb7b8d98553afbcc510a42051 100644 --- a/system/bta/test/bta_dip_test.cc +++ b/system/bta/test/bta_dip_test.cc @@ -20,7 +20,6 @@ #include "bta/sdp/bta_sdp_act.cc" #include "main/shim/metrics_api.h" -#include "stack/sdp/sdp_api.cc" #include "types/bluetooth/uuid.h" #include "types/raw_address.h"