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

Commit 56c2a0d0 authored by Wenyu Zhang's avatar Wenyu Zhang Committed by Android (Google) Code Review
Browse files

Merge "Reuse getDevicesForAttributes for get input devices" into main

parents 92d7d4e0 8558a337
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -21,6 +21,13 @@ flag {
    bug: "342413767"
}

flag {
    name: "enable_audio_input_device_routing"
    namespace: "media_audio"
    description: "Allow audio input devices routing control."
    bug: "364923030"
}

flag {
    name: "fdtostring_timeout_fix"
    namespace: "media_audio"
+16 −0
Original line number Diff line number Diff line
@@ -9068,6 +9068,13 @@ sp<SwAudioOutputDescriptor> AudioPolicyManager::openOutputWithProfileAndDevice(

status_t AudioPolicyManager::getDevicesForAttributes(
        const audio_attributes_t &attr, DeviceVector &devices, bool forVolume) {
    // attr containing source set by AudioAttributes.Builder.setCapturePreset() has precedence
    // over any usage or content type also present in attr.
    if (com::android::media::audioserver::enable_audio_input_device_routing() &&
        attr.source != AUDIO_SOURCE_INVALID) {
        return getInputDevicesForAttributes(attr, devices);
    }

    // Devices are determined in the following precedence:
    //
    // 1) Devices associated with a dynamic policy matching the attributes.  This is often
@@ -9131,6 +9138,15 @@ status_t AudioPolicyManager::getDevicesForAttributes(
    return NO_ERROR;
}

status_t AudioPolicyManager::getInputDevicesForAttributes(
        const audio_attributes_t &attr, DeviceVector &devices) {
    devices = DeviceVector(
            mEngine->getInputDeviceForAttributes(attr, 0 /*uid unknown here*/,
                                                 AUDIO_SESSION_NONE,
                                                 nullptr /* mix */));
    return NO_ERROR;
}

status_t AudioPolicyManager::getProfilesForDevices(const DeviceVector& devices,
                                                   AudioProfileVector& audioProfiles,
                                                   uint32_t flags,
+5 −0
Original line number Diff line number Diff line
@@ -1366,6 +1366,11 @@ private:
                                         DeviceVector &devices,
                                         bool forVolume);

        // A helper method used by getDevicesForAttributes to retrieve input devices when
        // capture preset is available in the given audio attributes parameter.
        status_t getInputDevicesForAttributes(const audio_attributes_t &attr,
                                              DeviceVector &devices);

        status_t getProfilesForDevices(const DeviceVector& devices,
                                       AudioProfileVector& audioProfiles,
                                       uint32_t flags,