From f64e0edafe8ce32565ada5c3c7898e9a947e8cd0 Mon Sep 17 00:00:00 2001 From: Ganesh Ganapathi Batta Date: Wed, 12 Sep 2012 19:03:47 -0700 Subject: Defer sending RC pass-through commands until A2DP connection is up Root cause for the bug is RC connection establishment before A2DP connection and play command from carkit arriving in mid of A2DP connection. Bug: 7131791 Change-Id: I74e7c456f68c5ab5a02e827c9a1e14d770f5ec2a --- btif/src/btif_av.c | 6 +++--- btif/src/btif_rc.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) mode change 100644 => 100755 btif/src/btif_av.c (limited to 'btif') diff --git a/btif/src/btif_av.c b/btif/src/btif_av.c old mode 100644 new mode 100755 index a2de03e..d25fb61 --- a/btif/src/btif_av.c +++ b/btif/src/btif_av.c @@ -399,7 +399,6 @@ static BOOLEAN btif_av_state_closing_handler(btif_sm_event_t event, void *p_data /* immediately stop transmission of frames */ btif_a2dp_set_tx_flush(TRUE); - /* wait for audioflinger to stop a2dp */ break; @@ -963,7 +962,8 @@ const btav_interface_t *btif_av_get_interface(void) ** Returns boolean ** *******************************************************************************/ -BOOLEAN btif_av_is_rc_open_without_a2dp(void) +BOOLEAN btif_av_is_connected(void) { - return (tle_av_open_on_rc.in_use); + btif_sm_state_t state = btif_sm_get_state(btif_av_cb.sm_handle); + return ((state == BTIF_AV_STATE_OPENED) || (state == BTIF_AV_STATE_STARTED)); } diff --git a/btif/src/btif_rc.c b/btif/src/btif_rc.c index 530c7f1..68ddf5b 100644 --- a/btif/src/btif_rc.c +++ b/btif/src/btif_rc.c @@ -100,7 +100,7 @@ static btif_rc_cb_t btif_rc_cb; ******************************************************************************/ extern BOOLEAN btif_hf_call_terminated_recently(); extern BOOLEAN check_cod(const bt_bdaddr_t *remote_bdaddr, uint32_t cod); -BOOLEAN btif_av_is_rc_open_without_a2dp(void); +extern BOOLEAN btif_av_is_connected(void); /***************************************************************************** ** Functions @@ -299,7 +299,7 @@ void handle_rc_passthrough_cmd ( tBTA_AV_REMOTE_CMD *p_remote_cmd) if (p_remote_cmd) { /* queue AVRC PLAY if GAVDTP Open notification to app is pending (2 second timer) */ - if ((p_remote_cmd->rc_id == BTA_AV_RC_PLAY) && btif_av_is_rc_open_without_a2dp()) + if ((p_remote_cmd->rc_id == BTA_AV_RC_PLAY) && (!btif_av_is_connected())) { if (p_remote_cmd->key_state == AVRC_STATE_PRESS) { -- cgit v1.1