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

Commit 2cb8aa4c authored by Albin Joy's avatar Albin Joy Committed by android-build-merger
Browse files

HFP: notify HF about call status forcibly

am: 37df554a

Change-Id: Ib5495e1f600f82993382e4a0078af30fefd50fc4
parents 227f4f12 37df554a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1614,6 +1614,11 @@ void bta_ag_hfp_result(tBTA_AG_SCB* p_scb, tBTA_AG_API_RESULT* p_result) {
                      false);
      break;

    case BTA_AG_IND_RES_ON_DEMAND:
      bta_ag_send_ind(p_scb, p_result->data.ind.id, p_result->data.ind.value,
                      true);
      break;

    case BTA_AG_BVRA_RES:
      bta_ag_send_result(p_scb, p_result->result, NULL, p_result->data.state);
      break;
+1 −0
Original line number Diff line number Diff line
@@ -140,6 +140,7 @@ typedef uint8_t tBTA_AG_STATUS;
#define BTA_AG_UNAT_RES 20         /* Response to unknown AT command event */
#define BTA_AG_MULTI_CALL_RES 21   /* SLC at three way call */
#define BTA_AG_BIND_RES 22         /* Activate/Deactivate HF indicator */
#define BTA_AG_IND_RES_ON_DEMAND 33 /* Update an indicator value forcible */

typedef uint8_t tBTA_AG_RES;

+31 −0
Original line number Diff line number Diff line
@@ -254,6 +254,26 @@ static void send_indicator_update(uint16_t indicator, uint16_t value) {
  BTA_AgResult(BTA_AG_HANDLE_ALL, BTA_AG_IND_RES, &ag_res);
}

/*******************************************************************************
 *
 * Function         send_call_status_forcibly
 *
 * Description      Send call status
 *
 * Returns          void
 *
 *******************************************************************************/
static void send_call_status_forcibly(uint16_t value) {
  tBTA_AG_RES_DATA ag_res;

  memset(&ag_res, 0, sizeof(tBTA_AG_RES_DATA));

  ag_res.ind.id = BTA_AG_IND_CALL;
  ag_res.ind.value = value;

  BTA_AgResult(BTA_AG_HANDLE_ALL, BTA_AG_IND_RES_ON_DEMAND, &ag_res);
}

void clear_phone_state_multihf(int idx) {
  btif_hf_cb[idx].call_setup_state = BTHF_CALL_STATE_IDLE;
  btif_hf_cb[idx].num_active = btif_hf_cb[idx].num_held = 0;
@@ -1427,6 +1447,17 @@ static bt_status_t phone_state_change(int num_active, int num_held,
    send_indicator_update(BTA_AG_IND_CALLHELD, 1);
  }

  /* When call is hung up and still there is another call is in active,
   * some of the HF cannot acquire the call states by its own. If HF try
   * to terminate a call, it may not send the command AT+CHUP because the
   * call states are not updated properly. HF should get informed the call
   * status forcibly.
   */
  if ((btif_hf_cb[idx].num_active == num_active && num_active != 0) &&
      (btif_hf_cb[idx].num_held != num_held && num_held == 0)) {
    send_call_status_forcibly((uint16_t)num_active);
  }

update_call_states:
  for (i = 0; i < btif_max_hf_clients; i++) {
    if (btif_hf_cb[i].state == BTHF_CONNECTION_STATE_SLC_CONNECTED) {