audio: add API for querying the Ultrasound support
Bug: 200256985
Test: Check the return value with/without the Ultrasound
Output/Input in audio_policy_configuration.xml
Signed-off-by: Carter Hsu <carterhsu@google.com>
Change-Id: I681491bc21788e7eb75a052025a3feed89033524
diff --git a/media/libaudioclient/AudioSystem.cpp b/media/libaudioclient/AudioSystem.cpp
index b3c82787..16e9ec3 100644
--- a/media/libaudioclient/AudioSystem.cpp
+++ b/media/libaudioclient/AudioSystem.cpp
@@ -1972,6 +1972,19 @@
return result.value_or(false);
}
+bool AudioSystem::isUltrasoundSupported() {
+ const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
+ if (aps == 0) return false;
+
+ auto result = [&]() -> ConversionResult<bool> {
+ bool retVal;
+ RETURN_IF_ERROR(
+ statusTFromBinderStatus(aps->isUltrasoundSupported(&retVal)));
+ return retVal;
+ }();
+ return result.value_or(false);
+}
+
status_t AudioSystem::getHwOffloadFormatsSupportedForBluetoothMedia(
audio_devices_t device, std::vector<audio_format_t>* formats) {
if (formats == nullptr) {