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

Commit 07b726a1 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

release-request-7f84484c-eec6-4577-8d5a-55079be4f3c5-for-git_oc-mr1-release-42...

release-request-7f84484c-eec6-4577-8d5a-55079be4f3c5-for-git_oc-mr1-release-4262309 snap-temp-L02100000091441105

Change-Id: Iac308175409c7f7fb1764a0765c5f6e7f4b35224
parents 4d378584 fa43e57c
Loading
Loading
Loading
Loading
+28 −6
Original line number Diff line number Diff line
@@ -1793,6 +1793,15 @@ static int stop_output_stream(struct stream_out *out)
    /* Must be called after removing the usecase from list */
    if (out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL)
        check_and_set_hdmi_channels(adev, DEFAULT_HDMI_OUT_CHANNELS);
    else if (out->devices & AUDIO_DEVICE_OUT_SPEAKER_SAFE) {
        struct listnode *node;
        struct audio_usecase *usecase;
        list_for_each(node, &adev->usecase_list) {
            usecase = node_to_item(node, struct audio_usecase, list);
            if (usecase->devices & AUDIO_DEVICE_OUT_SPEAKER)
                select_devices(adev, usecase->id);
        }
    }

    ALOGV("%s: exit: status(%d)", __func__, ret);
    return ret;
@@ -2174,6 +2183,15 @@ static bool output_drives_call(struct audio_device *adev, struct stream_out *out
    return out == adev->primary_output || out == adev->voice_tx_output;
}

static int get_alive_usb_card(struct str_parms* parms) {
    int card;
    if ((str_parms_get_int(parms, "card", &card) >= 0) &&
        !audio_extn_usb_alive(card)) {
        return card;
    }
    return -ENODEV;
}

static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
{
    struct stream_out *out = (struct stream_out *)stream;
@@ -2211,9 +2229,11 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)

        // Workaround: If routing to an non existing usb device, fail gracefully
        // The routing request will otherwise block during 10 second
        if (audio_is_usb_out_device(new_dev) && !audio_extn_usb_alive(adev->snd_card)) {
            ALOGW("out_set_parameters() ignoring rerouting to non existing USB card %d",
                  adev->snd_card);
        int card;
        if (audio_is_usb_out_device(new_dev) &&
            (card = get_alive_usb_card(parms)) >= 0) {

            ALOGW("out_set_parameters() ignoring rerouting to non existing USB card %d", card);
            pthread_mutex_unlock(&adev->lock);
            pthread_mutex_unlock(&out->lock);
            status = -ENOSYS;
@@ -3140,9 +3160,11 @@ static int in_set_parameters(struct audio_stream *stream, const char *kvpairs)

            // Workaround: If routing to an non existing usb device, fail gracefully
            // The routing request will otherwise block during 10 second
            if (audio_is_usb_in_device(val) && !audio_extn_usb_alive(adev->snd_card)) {
                ALOGW("in_set_parameters() ignoring rerouting to non existing USB card %d",
                      adev->snd_card);
            int card;
            if (audio_is_usb_in_device(val) &&
                (card = get_alive_usb_card(parms)) >= 0) {

                ALOGW("in_set_parameters() ignoring rerouting to non existing USB card %d", card);
                status = -ENOSYS;
            } else {