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

Commit 03819070 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "hal: Fix android music app crash when turning ANC OFF"

parents c497a3ca c0536544
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ void audio_extn_ssr_get_parameters(struct str_parms *query,
#endif

#ifndef ANC_HEADSET_ENABLED
#define audio_extn_set_anc_parameters(parms)       (0)
#define audio_extn_set_anc_parameters(adev, parms)       (0)
#else
bool audio_extn_get_anc_enabled(void)
{
@@ -97,10 +97,13 @@ bool audio_extn_should_use_fb_anc(void)
  return false;
}

void audio_extn_set_anc_parameters(struct str_parms *parms)
void audio_extn_set_anc_parameters(struct audio_device *adev,
                                   struct str_parms *parms)
{
    int ret;
    char value[32] ={0};
    struct listnode *node;
    struct audio_usecase *usecase;

    ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_ANC, value,
                            sizeof(value));
@@ -111,6 +114,20 @@ void audio_extn_set_anc_parameters(struct str_parms *parms)
            aextnmod.anc_enabled = false;
    }

    list_for_each(node, &adev->usecase_list) {
        usecase = node_to_item(node, struct audio_usecase, list);
        if (usecase->type == PCM_PLAYBACK) {
            if (usecase->stream.out->devices == \
                AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
                usecase->stream.out->devices ==  \
                AUDIO_DEVICE_OUT_WIRED_HEADSET) {
                select_devices(adev, usecase->id);
                ALOGV("%s: switching device", __func__);
                break;
            }
        }
    }

    ALOGD("%s: anc_enabled:%d", __func__, aextnmod.anc_enabled);
}
#endif /* ANC_HEADSET_ENABLED */
@@ -196,7 +213,7 @@ int audio_extn_get_afe_proxy_parameters(struct str_parms *query,
void audio_extn_set_parameters(struct audio_device *adev,
                               struct str_parms *parms)
{
   audio_extn_set_anc_parameters(parms);
   audio_extn_set_anc_parameters(adev, parms);
   audio_extn_set_afe_proxy_parameters(parms);
   audio_extn_fm_set_parameters(adev, parms);
   audio_extn_listen_set_parameters(adev, parms);
+2 −9
Original line number Diff line number Diff line
@@ -1073,18 +1073,11 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
                set_echo_reference(adev->mixer, "NONE");
        }
    } else if (source == AUDIO_SOURCE_MIC) {
        if (in_device & AUDIO_DEVICE_IN_BACK_MIC) {
            if(my_data->fluence_type & FLUENCE_DUAL_MIC &&
                    my_data->fluence_in_audio_rec)
                snd_device = SND_DEVICE_IN_SPEAKER_DMIC;
            else
                snd_device = SND_DEVICE_IN_SPEAKER_MIC;
        } else if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) {
        if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC &&
                channel_count == 1 ) {
            if(my_data->fluence_type & FLUENCE_DUAL_MIC &&
                    my_data->fluence_in_audio_rec)
                snd_device = SND_DEVICE_IN_HANDSET_DMIC;
            else
                snd_device = SND_DEVICE_IN_HANDSET_MIC;
        }
    } else if (source == AUDIO_SOURCE_FM_RX ||
               source == AUDIO_SOURCE_FM_RX_A2DP) {