Add interface to query the mmap support.
Currently, the mmap support is defined in system property. But the
system property only indicates if the mmap is supported or not. It
doesn't indicate on which device mmap is supported. In that case, adding
an interface to query the mmap support can help make things clear.
Test: atest AAudioTests
Test: Run OboeTester TEST OUTPUT
Test: Verify that MMAP is showed as enabled if supported
Test: Try toggling MMAP on and off when opening streams
Bug: 193275465
Change-Id: Iac289c1a02e6e2ab4076ab6f2b5045efecad97ac
diff --git a/media/libaudioclient/AudioSystem.cpp b/media/libaudioclient/AudioSystem.cpp
index 46ad296..97cb9af 100644
--- a/media/libaudioclient/AudioSystem.cpp
+++ b/media/libaudioclient/AudioSystem.cpp
@@ -2359,6 +2359,16 @@
return af->setVibratorInfos(vibratorInfos);
}
+status_t AudioSystem::getMmapPolicyInfo(
+ media::AudioMMapPolicyType policyType,
+ std::vector<media::AudioMMapPolicyInfo> *policyInfos) {
+ const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
+ if (af == nullptr) {
+ return PERMISSION_DENIED;
+ }
+ return af->getMmapPolicyInfos(policyType, policyInfos);
+}
+
// ---------------------------------------------------------------------------
int AudioSystem::AudioPolicyServiceClient::addAudioPortCallback(