audio: Align Module::getMmapPolicyInfos behavior with legacy
When there are no device ports supporting MMAP,
Module::getMmapPolicyInfos have to return 'Policy::NEVER'
so that the AAudio code does not attempt to use
the AAudio service. This aligns with the use of sysprops
by the HIDL implementation.
Update AudioCoreModule#GetMmapPolicyInfos test to use
the same logic for determining MMAP support as the framework
uses.
This makes CtsNativeMediaAAudioTest cases passing with
the AIDL HAL on Cuttlefish.
Bug: 302049825
Test: atest VtsHalAudioCoreTargetTest
Test: atest CtsNativeMediaAAudioTest [w/AIDL enabled on CF]
Change-Id: Ie58c408f6f648a8a03b6a5d92118b90061389c50
diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp
index 3117134..819b3c5 100644
--- a/audio/aidl/default/Module.cpp
+++ b/audio/aidl/default/Module.cpp
@@ -1277,6 +1277,12 @@
mmapSources.insert(port.id);
}
}
+ if (mmapSources.empty() && mmapSinks.empty()) {
+ AudioMMapPolicyInfo never;
+ never.mmapPolicy = AudioMMapPolicy::NEVER;
+ _aidl_return->push_back(never);
+ return ndk::ScopedAStatus::ok();
+ }
for (const auto& route : getConfig().routes) {
if (mmapSinks.count(route.sinkPortId) != 0) {
// The sink is a mix port, add the sources if they are device ports.