Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73f743c9 authored by minle.zuo's avatar minle.zuo Committed by Andre Eisenbach
Browse files

HFP: Only active BT device can hung up call

Some inactive devices can't send hung up key to host when
HFP connected and active call exist.
And other inactive devices can send hung up call by
sending hung up command.

Solution: To keep consistency of this behavior, 
only allow active BT device to hung up call.

Test: Active device can hung up call and inactive can't hung up

Change-Id: Iec1ae689f1d40c15199707e9e925814f71ded619
parent 2157782f
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -860,12 +860,22 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB* p_scb, uint16_t cmd, uint8_t arg_type,
    case BTA_AG_AT_A_EVT:
    case BTA_AG_SPK_EVT:
    case BTA_AG_MIC_EVT:
    case BTA_AG_AT_CHUP_EVT:
    case BTA_AG_AT_CBC_EVT:
      /* send OK */
      bta_ag_send_ok(p_scb);
      break;

    case BTA_AG_AT_CHUP_EVT:
      if (!bta_ag_sco_is_active_device(p_scb->peer_addr)) {
        LOG(WARNING) << __func__ << ": AT+CHUP rejected as " << p_scb->peer_addr
                << " is not the active device";
        event = 0;
        bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_ALLOWED);
      } else {
        bta_ag_send_ok(p_scb);
      }
      break;

    case BTA_AG_AT_BLDN_EVT:
      /* Do not send OK, App will send error or OK depending on
      ** last dial number enabled or not */