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

Commit 076fa62c authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "hal: fix bt sco and a2dp concurrency issues"

parents 0044e875 d96af8ff
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -8207,7 +8207,6 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
    int status = 0;
    bool a2dp_reconfig = false;
    struct listnode *node;
    struct audio_usecase *usecase = NULL;
    int controller = -1, stream = -1;

    ALOGD("%s: enter: %s", __func__, kvpairs);
@@ -8240,20 +8239,29 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
        if (strcmp(value, AUDIO_PARAMETER_VALUE_ON) == 0){
            adev->bt_sco_on = true;
        } else {
            ALOGD("sco is off, reset sco and route device to handset mic");
            adev->bt_sco_on = false;
            audio_extn_sco_reset_configuration();
        }
    }

    ret = str_parms_get_str(parms, "A2dpSuspended", value, sizeof(value));
    if (ret>=0) {
        if (!strncmp(value, "false", 5) &&
            audio_extn_a2dp_source_is_suspended()) {
            struct audio_usecase *usecase;
            struct listnode *node;
            list_for_each(node, &adev->usecase_list) {
                usecase = node_to_item(node, struct audio_usecase, list);
                if ((usecase->type == PCM_CAPTURE) && usecase->stream.in &&
                    (usecase->stream.in->device & AUDIO_DEVICE_IN_ALL_SCO))
                if (usecase->stream.in && (usecase->type == PCM_CAPTURE) &&
                    ((usecase->stream.in->device & ~AUDIO_DEVICE_BIT_IN) &
                        AUDIO_DEVICE_IN_ALL_SCO)) {
                    ALOGD("a2dp resumed, switch bt sco mic to handset mic");
                    usecase->stream.in->device = AUDIO_DEVICE_IN_BUILTIN_MIC;
                else
                    continue;
                    select_devices(adev, usecase->id);
                }
            }
        }
    }

    status = voice_set_parameters(adev, parms);
    if (status != 0)