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

Commit c66eb7e3 authored by Zhou Song's avatar Zhou Song Committed by Garmond Leung
Browse files

hal: fix music playback mute issues for a2dp suspended scenarios

Music may not be resumed after A2DP resumed due to improper mute
applied and not restored.

CRs-Fixed: 2088539

Change-Id: I3a222f128659de603504f6bed4d4e3cdcc7a125b
parent d539d524
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -805,7 +805,8 @@ void audio_extn_a2dp_set_parameters(struct str_parms *parms)
                a2dp.a2dp_suspended = true;
                list_for_each(node, &a2dp.adev->usecase_list) {
                    uc_info = node_to_item(node, struct audio_usecase, list);
                    if (uc_info->type == PCM_PLAYBACK) {
                    if (uc_info->type == PCM_PLAYBACK &&
                         (uc_info->stream.out->devices & AUDIO_DEVICE_OUT_ALL_A2DP)) {
                        pthread_mutex_unlock(&a2dp.adev->lock);
                        check_a2dp_restore(a2dp.adev, uc_info->stream.out, false);
                        pthread_mutex_lock(&a2dp.adev->lock);
@@ -844,7 +845,8 @@ void audio_extn_a2dp_set_parameters(struct str_parms *parms)
                }
                list_for_each(node, &a2dp.adev->usecase_list) {
                    uc_info = node_to_item(node, struct audio_usecase, list);
                    if (uc_info->type == PCM_PLAYBACK) {
                    if (uc_info->type == PCM_PLAYBACK &&
                         (uc_info->stream.out->devices & AUDIO_DEVICE_OUT_ALL_A2DP)) {
                        pthread_mutex_unlock(&a2dp.adev->lock);
                        check_a2dp_restore(a2dp.adev, uc_info->stream.out, true);
                        pthread_mutex_lock(&a2dp.adev->lock);
+3 −3
Original line number Diff line number Diff line
@@ -1731,10 +1731,10 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id)
            voice_check_and_update_aanc_path(adev, usecase->out_snd_device, false);
    }

    if ((usecase->out_snd_device == SND_DEVICE_OUT_SPEAKER_AND_BT_A2DP) &&
    if ((out_snd_device == SND_DEVICE_OUT_SPEAKER_AND_BT_A2DP) &&
        (!audio_extn_a2dp_is_ready())) {
        ALOGW("%s: A2DP profile is not ready, routing to speaker only", __func__);
        usecase->out_snd_device = SND_DEVICE_OUT_SPEAKER;
        out_snd_device = SND_DEVICE_OUT_SPEAKER;
    }

    /* Disable current sound devices */
@@ -3113,7 +3113,7 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
                    audio_extn_perf_lock_release(&adev->perf_lock_handle);
                if ((out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) &&
                    out->a2dp_compress_mute &&
                    (!(out->devices & AUDIO_DEVICE_OUT_ALL_A2DP))) {
                    (!(out->devices & AUDIO_DEVICE_OUT_ALL_A2DP) || audio_extn_a2dp_is_ready())) {
                    pthread_mutex_lock(&out->compr_mute_lock);
                    out->a2dp_compress_mute = false;
                    out_set_compr_volume(&out->stream, out->volume_l, out->volume_r);