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

Commit 67c2f6d9 authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

AIDL: Add unit tests to external device disconnection

Add tests for the code added in aosp/3005114.
Fix a minor issue found. It can lead to accumulating
entries in `mFwkPatches` for "implicit" patches.
This should rarely occur in practice as the framework
usually creates explicit patches for external devices.

Bug: 327449747
Test: atest CoreAudioHalAidlTest
Change-Id: I9c4a045bb5dba2b33acb65f7aba1a447a3dac4d0
parent 6faf6193
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -450,7 +450,7 @@ status_t Hal2AidlMapper::findPortConfig(const AudioDevice& device, AudioPortConf
        *portConfig = it->second;
        return OK;
    }
    ALOGE("%s: could not find a configured device port for device %s",
    ALOGE("%s: could not find a device port config for device %s",
            __func__, device.toString().c_str());
    return BAD_VALUE;
}
@@ -1020,6 +1020,13 @@ status_t Hal2AidlMapper::setDevicePortConnectedState(const AudioPort& devicePort
                }
            }
            resetUnusedPortConfigs();
            // Patches created by Hal2AidlMapper during stream creation and not "claimed"
            // by the framework must not be surfaced to it.
            for (auto& s : mStreams) {
                if (auto it = releasedPatches.find(s.second.second); it != releasedPatches.end()) {
                    releasedPatches.erase(it);
                }
            }
            mFwkPatches.merge(releasedPatches);
            LOG_ALWAYS_FATAL_IF(!releasedPatches.empty(),
                    "mFwkPatches already contains some of released patches");
+564 −16

File changed.

Preview size limit exceeded, changes collapsed.