OSDN Git Service

Reject AVDTP START and SUSPEND request in invalid state
authorAnubhav Gupta <anubhavg@codeaurora.org>
Wed, 6 May 2015 10:54:10 +0000 (16:24 +0530)
committerAndre Eisenbach <eisenbach@google.com>
Tue, 16 Jun 2015 16:37:52 +0000 (09:37 -0700)
Reject remote initiated AVDTP START and SUSPEND request
in invalid state. This helps passing the below PTS cases.
TC_ACP_SRC_SIG_SMG_BI_20
TC_ACP_SRC_SIG_SMG_BI_26

Change-Id: I177456389246df89e7d7560555ffffde0639e618

stack/avdt/avdt_ccb_act.c

index b1ef12e..4dd9b23 100644 (file)
@@ -270,18 +270,16 @@ void avdt_ccb_hdl_getcap_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
 *******************************************************************************/
 void avdt_ccb_hdl_start_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
 {
-    UINT8   seid;
-    UINT8   err_code;
+    UINT8   err_code = 0;
 
     /* verify all streams in the right state */
-    if ((seid = avdt_scb_verify(p_ccb, AVDT_VERIFY_START, p_data->msg.multi.seid_list,
-                                p_data->msg.multi.num_seps, &err_code)) == 0)
+    UINT8 seid = avdt_scb_verify(p_ccb, AVDT_VERIFY_START, p_data->msg.multi.seid_list,
+                                 p_data->msg.multi.num_seps, &err_code);
+    if (seid == 0 && err_code == 0)
     {
         /* we're ok, send response */
         avdt_ccb_event(p_ccb, AVDT_CCB_API_START_RSP_EVT, p_data);
-    }
-    else
-    {
+    } else {
         /* not ok, send reject */
         p_data->msg.hdr.err_code = err_code;
         p_data->msg.hdr.err_param = seid;
@@ -343,11 +341,12 @@ void avdt_ccb_hdl_start_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
 void avdt_ccb_hdl_suspend_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
 {
     UINT8   seid;
-    UINT8   err_code;
+    UINT8   err_code = 0;
 
     /* verify all streams in the right state */
     if ((seid = avdt_scb_verify(p_ccb, AVDT_VERIFY_SUSPEND, p_data->msg.multi.seid_list,
-                                p_data->msg.multi.num_seps, &err_code)) == 0)
+                                p_data->msg.multi.num_seps, &err_code)) == 0 &&
+                                err_code == 0)
     {
         /* we're ok, send response */
         avdt_ccb_event(p_ccb, AVDT_CCB_API_SUSPEND_RSP_EVT, p_data);