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

Commit 9dad5382 authored by Stanley Tng's avatar Stanley Tng
Browse files

When stopping Hearing Aids, send Stop cmd to devices

This fixes the bug where the Stop command is not send to the Hearing
Aids devices which switching audio away from Hearing Aid.

Bug: 126465843
Test: Manual switching between A2DP and Hearing Aids while
playing audio.

Change-Id: Ifd8eaed7496e7e16c3948683c518d7627824d3e8
parent f8e86f4c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ void hearing_aid_data_cb(tUIPC_CH_ID, tUIPC_EVENT event) {
  DVLOG(2) << "Hearing Aid audio data event: " << event;
  switch (event) {
    case UIPC_OPEN_EVT:
      LOG(INFO) << __func__ << ": UIPC_OPEN_EVT";
      /*
       * Read directly from media task from here on (keep callback for
       * connection events.
@@ -116,6 +117,7 @@ void hearing_aid_data_cb(tUIPC_CH_ID, tUIPC_EVENT event) {
                         nullptr);
      break;
    case UIPC_CLOSE_EVT:
      LOG(INFO) << __func__ << ": UIPC_CLOSE_EVT";
      hearing_aid_send_ack(HEARING_AID_CTRL_ACK_SUCCESS);
      if (audio_timer) {
        alarm_cancel(audio_timer);
@@ -164,6 +166,9 @@ void hearing_aid_recv_ctrl_data() {
      break;

    case HEARING_AID_CTRL_CMD_STOP:
      if (!hearing_aid_on_suspend_req()) {
        LOG(INFO) << __func__ << ":HEARING_AID_CTRL_CMD_STOP: hearing_aid_on_suspend_req() errs, but ignored.";
      }
      hearing_aid_send_ack(HEARING_AID_CTRL_ACK_SUCCESS);
      break;