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

Commit 8c5b23df authored by Zheng Zhang's avatar Zheng Zhang
Browse files

audio: hal: fix click "resume call" two times will cause no sound in HFP call.

If click "resume call" many times when making hfp call, telecom will send
REQUEST_UNHOLD and call start_hfp in audio hal many times, then pcm_open
failed, and no sound will be heard when we make hfp call again. So return 0
at the beginning of start_hfp if hfp is already active.

Bug: 33226115
Bug: 33459120

Change-Id: I517918ef55fce96cf3761e04db89ed634250165f
parent ddad829c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <cutils/str_parms.h>
#include "audio_extn/tfa_98xx.h"
#include "audio_extn.h"

#define AUDIO_PARAMETER_HFP_ENABLE            "hfp_enable"
#define AUDIO_PARAMETER_HFP_SET_SAMPLING_RATE "hfp_set_sampling_rate"
@@ -247,6 +248,11 @@ static int32_t start_hfp(struct audio_device *adev,
    int32_t pcm_dev_rx_id, pcm_dev_tx_id, pcm_dev_asm_rx_id, pcm_dev_asm_tx_id;

    ALOGD("%s: enter", __func__);

    if (adev->enable_hfp == true) {
        ALOGD("%s: HFP is already active!\n", __func__);
        return 0;
    }
    adev->enable_hfp = true;
    platform_set_mic_mute(adev->platform, false);