Code: static int a2dp_command(struct a2dp_stream_common *common, char cmd)
{
 char ack;


     DEBUG("A2DP COMMAND %s", dump_a2dp_ctrl_event(cmd));
 
     /* send command */
    if (send(common->ctrl_fd, &cmd, 1, MSG_NOSIGNAL) == -1)
     {
         ERROR("cmd failed (%s)", strerror(errno));
         skt_disconnect(common->ctrl_fd);
        common->ctrl_fd = AUDIO_SKT_DISCONNECTED;
 return -1;
 }

 /* wait for ack byte */
 if (a2dp_ctrl_receive(common, &ack, 1) < 0)
 return -1;

    DEBUG("A2DP COMMAND %s DONE STATUS %d", dump_a2dp_ctrl_event(cmd), ack);

 if (ack == A2DP_CTRL_ACK_INCALL_FAILURE)
 return ack;
 if (ack != A2DP_CTRL_ACK_SUCCESS)
 return -1;

 return 0;
}

Commit Message: DO NOT MERGE Fix potential DoS caused by delivering signal to BT process

Bug: 28885210
Change-Id: I63866d894bfca47464d6e42e3fb0357c4f94d360

 Conflicts:
	btif/co/bta_hh_co.c
	btif/src/btif_core.c
Merge conflict resolution of ag/1161415 (referencing ag/1164670)
- Directly into mnc-mr2-release

CWE ID: CWE-284
static int a2dp_command(struct a2dp_stream_common *common, char cmd)
{
 char ack;


     DEBUG("A2DP COMMAND %s", dump_a2dp_ctrl_event(cmd));
 
     /* send command */
    if (TEMP_FAILURE_RETRY(send(common->ctrl_fd, &cmd, 1, MSG_NOSIGNAL)) == -1)
     {
         ERROR("cmd failed (%s)", strerror(errno));
         skt_disconnect(common->ctrl_fd);
        common->ctrl_fd = AUDIO_SKT_DISCONNECTED;
 return -1;
 }

 /* wait for ack byte */
 if (a2dp_ctrl_receive(common, &ack, 1) < 0)
 return -1;

    DEBUG("A2DP COMMAND %s DONE STATUS %d", dump_a2dp_ctrl_event(cmd), ack);

 if (ack == A2DP_CTRL_ACK_INCALL_FAILURE)
 return ack;
 if (ack != A2DP_CTRL_ACK_SUCCESS)
 return -1;

 return 0;
}
