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

Commit 7c25dd0e authored by Mikhail Naganov's avatar Mikhail Naganov Committed by Cherrypicker Worker
Browse files

libaudiohal@aidl: Log clarifications

Add a note about useless port IDs in the patch request.

Correct messages about finding the device port in
`setConnectedState`.

Bug: 298175108
Test: atest audiosystem_tests
(cherry picked from https://android-review.googlesource.com/q/commit:02038015acaa3913bf41deb5e7487021ab8ab7c9)
Merged-In: I0f0d476b9684c3e351ce1ab7047f5c2e34ce3c7d
Change-Id: I0f0d476b9684c3e351ce1ab7047f5c2e34ce3c7d
parent 82992565
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -713,7 +713,11 @@ status_t DeviceHalAidl::createAudioPatch(unsigned int num_sources,
        aidlPatch.sourcePortConfigIds.clear();
        aidlPatch.sinkPortConfigIds.clear();
    }
    ALOGD("%s: sources: %s, sinks: %s",
    // The IDs will be found by 'fillPortConfigs', however the original 'aidlSources' and
    // 'aidlSinks' will not be updated because 'setAudioPatch' only needs IDs. Here we log
    // the source arguments, where only the audio configuration and device specifications
    // are relevant.
    ALOGD("%s: [disregard IDs] sources: %s, sinks: %s",
            __func__, ::android::internal::ToString(aidlSources).c_str(),
            ::android::internal::ToString(aidlSinks).c_str());
    auto fillPortConfigs = [&](
@@ -1078,9 +1082,10 @@ status_t DeviceHalAidl::setConnectedState(const struct audio_port_v7 *port, bool
        if (portsIt == mPorts.end()) {
            // Since 'setConnectedState' is called for all modules, it is normal when the device
            // port not found in every one of them.
            ALOGD("%s: device port for device %s is not found in the module %s",
                    __func__, matchDevice.toString().c_str(), mInstance.c_str());
            return BAD_VALUE;
        } else {
            ALOGD("%s: device port for device %s found in the module %s",
                    __func__, matchDevice.toString().c_str(), mInstance.c_str());
        }
        // Use the ID of the "template" port, use all the information from the provided port.
        aidlPort.id = portsIt->first;
@@ -1096,9 +1101,12 @@ status_t DeviceHalAidl::setConnectedState(const struct audio_port_v7 *port, bool
        AudioDevice matchDevice = aidlPort.ext.get<AudioPortExt::device>().device;
        auto portsIt = findPort(matchDevice);
        if (portsIt == mPorts.end()) {
            ALOGW("%s: device port for device %s is not found in the module %s",
                    __func__, matchDevice.toString().c_str(), mInstance.c_str());
            // Since 'setConnectedState' is called for all modules, it is normal when the device
            // port not found in every one of them.
            return BAD_VALUE;
        } else {
            ALOGD("%s: device port for device %s found in the module %s",
                    __func__, matchDevice.toString().c_str(), mInstance.c_str());
        }
        // Any streams opened on the external device must be closed by this time,
        // thus we can clean up patches and port configs that were created for them.