From 5ae72cf049004ac3c0f2f2bc048d1638a3b13d55 Mon Sep 17 00:00:00 2001 From: Zhihai Xu Date: Wed, 15 May 2013 17:29:44 -0700 Subject: [PATCH] Media profile drop on ending the outgoing video call and music is heard locally receive AVDTP_Suspend response rejection which cause the A2DP disocnnected. There is collision of AVDTP_Suspend request: We send AVDTP_Suspend request and the headset send AVDTP_Suspend request also at the same time. then We send AVDTP_Suspend response, but the headset send AVDTP_Suspend response rejection with error code bad state after it receive the AVDTP_Suspend response from us. we call bta_av_suspend_cfm twice in this case: the first time we will call bta_av_suspend_cfm without error after receive AVDTP_Suspend request from headset. the second time we will call bta_av_suspend_cfm with error bad state after receive AVDTP_Suspend response rejection from headset. To fix this problem, we should ignore the AVDTP_Suspend response rejection from headset after receive AVDTP_Suspend request from headset. After we receive AVDTP_Suspend request from headset, the scb state will be changed to AVDT_SCB_OPEN_ST from AVDT_SCB_STREAM_ST. but when we receive AVDTP_Suspend response rejection from headset, we should ignore it when we are in AVDT_SCB_OPEN_ST. and also currently we already ignore AVDTP_Suspend response when we are in AVDT_SCB_OPEN_ST, I don't know why we didn't do it for AVDTP Suspend rejection. issue 8735903 Change-Id: I8db3ea6e7e4edfea41f255e7e29b8c7255cf3d96 --- bta/av/bta_av_aact.c | 12 +++++++++++- stack/avdt/avdt_scb.c | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bta/av/bta_av_aact.c b/bta/av/bta_av_aact.c index 6a407e041..0f92677c2 100644 --- a/bta/av/bta_av_aact.c +++ b/bta/av/bta_av_aact.c @@ -2346,8 +2346,18 @@ void bta_av_suspend_cfm (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) APPL_TRACE_DEBUG2 ("bta_av_suspend_cfm:audio_open_cnt = %d, err_code = %d", bta_av_cb.audio_open_cnt, err_code); + if (p_scb->started == FALSE) + { + /* handle the condition where there is a collision of SUSPEND req from either side + ** Second SUSPEND req could be rejected. Do not treat this as a failure + */ + APPL_TRACE_WARNING1("bta_av_suspend_cfm: already suspended, ignore, err_code %d", + err_code); + return; + } + suspend_rsp.status = BTA_AV_SUCCESS; - if (err_code) + if (err_code && (err_code != AVDT_ERR_BAD_STATE)) { /* Disable suspend feature only with explicit rejection(not with timeout) */ if (err_code != AVDT_ERR_TIMEOUT) diff --git a/stack/avdt/avdt_scb.c b/stack/avdt/avdt_scb.c index b44af06c2..07c141fef 100644 --- a/stack/avdt/avdt_scb.c +++ b/stack/avdt/avdt_scb.c @@ -369,7 +369,7 @@ const UINT8 avdt_scb_st_open[][AVDT_SCB_NUM_COLS] = { /* MSG_GETCONFIG_RSP_EVT */ {AVDT_SCB_HDL_GETCONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST}, /* MSG_OPEN_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST}, /* MSG_START_RSP_EVT */ {AVDT_SCB_HDL_START_RSP, AVDT_SCB_IGNORE, AVDT_SCB_STREAM_ST}, -/* MSG_SUSPEND_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST}, +/* MSG_SUSPEND_RSP_EVT */ {AVDT_SCB_HDL_SUSPEND_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST}, /* MSG_CLOSE_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST}, /* MSG_ABORT_RSP_EVT */ {AVDT_SCB_IGNORE, AVDT_SCB_IGNORE, AVDT_SCB_IDLE_ST}, /* MSG_RECONFIG_RSP_EVT */ {AVDT_SCB_HDL_RECONFIG_RSP, AVDT_SCB_IGNORE, AVDT_SCB_OPEN_ST}, -- 2.11.0