diff options
author | Sal Savage <salsavage@google.com> | 2020-02-28 11:24:26 -0800 |
---|---|---|
committer | Sal Savage <salsavage@google.com> | 2021-01-12 13:51:35 -0800 |
commit | 47c183c4be63bb026d48bdaa92c228e852158977 (patch) | |
tree | 7a4471e2ff2fab74e4d1e1de36defa1f55466e5b /bta/av | |
parent | 2688c6629297d439c8c64f1feba3c97308d6675c (diff) | |
download | bt-47c183c4be63bb026d48bdaa92c228e852158977.tar.gz |
Allow NewAvrcp to manage its own SDP record
Tag: #feature
Bug: 153076316
Test: Build, flash, make sure SDP record matches existing SDP record
Change-Id: Ic5add2091d8e72386dc22811e7e580fd64a278f7
Diffstat (limited to 'bta/av')
-rw-r--r-- | bta/av/bta_av_act.cc | 12 | ||||
-rw-r--r-- | bta/av/bta_av_main.cc | 42 |
2 files changed, 36 insertions, 18 deletions
diff --git a/bta/av/bta_av_act.cc b/bta/av/bta_av_act.cc index 8dd523674..fafc21d00 100644 --- a/bta/av/bta_av_act.cc +++ b/bta/av/bta_av_act.cc @@ -2262,7 +2262,17 @@ void bta_av_dereg_comp(tBTA_AV_DATA* p_data) { /* remove the A2DP SDP record, if no more audio stream is left */ if (!p_cb->reg_audio) { - bta_ar_dereg_avrc(UUID_SERVCLASS_AV_REMOTE_CONTROL); + + /* Only remove the SDP record if we're the ones that created it */ + if (is_new_avrcp_enabled()) { + APPL_TRACE_DEBUG("%s: newavrcp is the owner of the AVRCP Target SDP " + "record. Don't dereg the SDP record", __func__); + } else { + APPL_TRACE_DEBUG("%s: newavrcp is not enabled. Remove SDP record", + __func__); + bta_ar_dereg_avrc(UUID_SERVCLASS_AV_REMOTE_CONTROL); + } + if (p_cb->sdp_a2dp_handle) { bta_av_del_sdp_rec(&p_cb->sdp_a2dp_handle); p_cb->sdp_a2dp_handle = 0; diff --git a/bta/av/bta_av_main.cc b/bta/av/bta_av_main.cc index e825aeec3..0a2a46087 100644 --- a/bta/av/bta_av_main.cc +++ b/bta/av/bta_av_main.cc @@ -32,6 +32,7 @@ #include "osi/include/osi.h" #include "osi/include/properties.h" +#include "avrcp_service.h" #include "bta_av_co.h" #include "bta_av_int.h" #include "btif/include/btif_av_co.h" @@ -477,25 +478,32 @@ static void bta_av_api_register(tBTA_AV_DATA* p_data) { /* For the Audio Sink role we support additional TG to support * absolute volume. */ - uint16_t profile_version = AVRC_REV_1_0; - - if (!strncmp(AVRCP_1_6_STRING, avrcp_version, - sizeof(AVRCP_1_6_STRING))) { - profile_version = AVRC_REV_1_6; - } else if (!strncmp(AVRCP_1_5_STRING, avrcp_version, - sizeof(AVRCP_1_5_STRING))) { - profile_version = AVRC_REV_1_5; - } else if (!strncmp(AVRCP_1_3_STRING, avrcp_version, - sizeof(AVRCP_1_3_STRING))) { - profile_version = AVRC_REV_1_3; + if (is_new_avrcp_enabled()) { + APPL_TRACE_DEBUG("%s: newavrcp is the owner of the AVRCP Target SDP " + "record. Don't create the SDP record", __func__); } else { - profile_version = AVRC_REV_1_4; + APPL_TRACE_DEBUG("%s: newavrcp is not enabled. Create SDP record", + __func__); + + uint16_t profile_version = AVRC_REV_1_0; + if (!strncmp(AVRCP_1_6_STRING, avrcp_version, + sizeof(AVRCP_1_6_STRING))) { + profile_version = AVRC_REV_1_6; + } else if (!strncmp(AVRCP_1_5_STRING, avrcp_version, + sizeof(AVRCP_1_5_STRING))) { + profile_version = AVRC_REV_1_5; + } else if (!strncmp(AVRCP_1_3_STRING, avrcp_version, + sizeof(AVRCP_1_3_STRING))) { + profile_version = AVRC_REV_1_3; + } else { + profile_version = AVRC_REV_1_4; + } + + bta_ar_reg_avrc( + UUID_SERVCLASS_AV_REM_CTRL_TARGET, "AV Remote Control Target", NULL, + p_bta_av_cfg->avrc_tg_cat, + (bta_av_cb.features & BTA_AV_FEAT_BROWSE), profile_version); } - - bta_ar_reg_avrc( - UUID_SERVCLASS_AV_REM_CTRL_TARGET, "AV Remote Control Target", NULL, - p_bta_av_cfg->avrc_tg_cat, - (bta_av_cb.features & BTA_AV_FEAT_BROWSE), profile_version); } /* Set the Capturing service class bit */ |