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

Commit bf5f4268 authored by jiabin's avatar jiabin
Browse files

APM: call getAudioPort to retrieve capabilities for input device port.

Bug: 277785275
Test: atest audiopolicy_tests
Change-Id: Ie98a66cd79c4ae4bb35a306bad04369f32cffc9b
parent 61e0b547
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -6082,6 +6082,14 @@ status_t AudioPolicyManager::checkInputsForDevice(const sp<DeviceDescriptor>& de
    }

    if (state == AUDIO_POLICY_DEVICE_STATE_AVAILABLE) {
        // first call getAudioPort to get the supported attributes from the HAL
        struct audio_port_v7 port = {};
        device->toAudioPort(&port);
        status_t status = mpClientInterface->getAudioPort(&port);
        if (status == NO_ERROR) {
            device->importAudioPort(port);
        }

        // look for input profiles that can be routed to this device
        SortedVector< sp<IOProfile> > profiles;
        for (const auto& hwModule : mHwModules) {
@@ -6133,11 +6141,7 @@ status_t AudioPolicyManager::checkInputsForDevice(const sp<DeviceDescriptor>& de

            desc = new AudioInputDescriptor(profile, mpClientInterface);
            audio_io_handle_t input = AUDIO_IO_HANDLE_NONE;
            status_t status = desc->open(nullptr,
                                         device,
                                         AUDIO_SOURCE_MIC,
                                         AUDIO_INPUT_FLAG_NONE,
                                         &input);
            status = desc->open(nullptr, device, AUDIO_SOURCE_MIC, AUDIO_INPUT_FLAG_NONE, &input);

            if (status == NO_ERROR) {
                const String8& address = String8(device->address().c_str());