OSDN Git Service

Do not request AVRC_CAP_COMPANY_ID if A2DP Sink is not enabled
authorAnubhavGupta <anubhavg@codeaurora.org>
Wed, 6 Apr 2016 06:17:05 +0000 (11:47 +0530)
committerAndre Eisenbach <eisenbach@google.com>
Thu, 9 Jun 2016 21:50:27 +0000 (14:50 -0700)
Also fixed AVRC_PDU_GET_PLAY_STATUS timeout response.

Bug: 28177785
Change-Id: Icde64a5c1806453850abe101f9707fff61566566
(cherry picked from commit 1c512b851d76deac860fce1232e4a1fa1a097f1c)

btif/include/btif_av.h
btif/src/btif_av.c
btif/src/btif_rc.c

index eaf856e..1fc7cfe 100644 (file)
@@ -80,6 +80,17 @@ btif_sm_handle_t btif_av_get_sm_handle(void);
 bt_bdaddr_t btif_av_get_addr(void);
 
 /*******************************************************************************
+** Function         btif_av_is_sink_enabled
+**
+** Description      Checks if A2DP Sink is enabled or not
+**
+** Returns          TRUE if A2DP Sink is enabled, false otherwise
+**
+*******************************************************************************/
+
+BOOLEAN btif_av_is_sink_enabled(void);
+
+/*******************************************************************************
 **
 ** Function         btif_av_stream_ready
 **
index 0f7af6c..03ba842 100644 (file)
@@ -1427,6 +1427,20 @@ bt_bdaddr_t btif_av_get_addr(void)
 }
 
 /*******************************************************************************
+** Function         btif_av_is_sink_enabled
+**
+** Description      Checks if A2DP Sink is enabled or not
+**
+** Returns          TRUE if A2DP Sink is enabled, false otherwise
+**
+*******************************************************************************/
+
+BOOLEAN btif_av_is_sink_enabled(void)
+{
+    return (bt_av_sink_callbacks != NULL) ? TRUE : FALSE;
+}
+
+/*******************************************************************************
 **
 ** Function         btif_av_stream_ready
 **
index 763809b..8805f4f 100644 (file)
@@ -457,7 +457,9 @@ void handle_rc_ctrl_features(BD_ADDR bd_addr)
              * update.
              */
             btif_rc_cb.rc_features_processed = TRUE;
-            getcapabilities_cmd (AVRC_CAP_COMPANY_ID);
+
+            if (btif_av_is_sink_enabled())
+                getcapabilities_cmd (AVRC_CAP_COMPANY_ID);
         }
         BTIF_TRACE_DEBUG("%s Update rc features to CTRL %d", __FUNCTION__, rc_features);
         HAL_CBACK(bt_rc_ctrl_callbacks, getrcfeatures_cb, &rc_addr, rc_features);
@@ -2090,8 +2092,8 @@ static void btif_rc_status_cmd_timeout_handler(UNUSED_ATTR uint16_t event,
         break;
 
     case AVRC_PDU_GET_PLAY_STATUS:
-        avrc_response.get_caps.status = BTIF_RC_STS_TIMEOUT;
-        handle_get_capability_response(&meta_msg, &avrc_response.get_caps);
+        avrc_response.get_play_status.status = BTIF_RC_STS_TIMEOUT;
+        handle_get_playstatus_response(&meta_msg, &avrc_response.get_play_status);
         break;
     }
     release_transaction(p_context->rc_status_cmd.label);