CSD: return interface for messages to audio server
Whenever the AudioService registers for receiving sound dose callbacks from the
native side, the native sends back the ISoundDose interface.
Test: logs, dumpsys and UT
Bug: 257238734
Change-Id: I5605196e8be91f00a7fbcf65573dfabe6e5c03d3
diff --git a/media/libaudioclient/AudioSystem.cpp b/media/libaudioclient/AudioSystem.cpp
index fa9239f..77c14a0 100644
--- a/media/libaudioclient/AudioSystem.cpp
+++ b/media/libaudioclient/AudioSystem.cpp
@@ -2374,13 +2374,18 @@
return OK;
}
-status_t AudioSystem::registerSoundDoseCallback(const sp<media::ISoundDoseCallback>& callback) {
+status_t AudioSystem::getSoundDoseInterface(const sp<media::ISoundDoseCallback>& callback,
+ sp<media::ISoundDose>* soundDose) {
const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
if (af == nullptr) {
return PERMISSION_DENIED;
}
+ if (soundDose == nullptr) {
+ return BAD_VALUE;
+ }
- return af->registerSoundDoseCallback(callback);
+ RETURN_STATUS_IF_ERROR(af->getSoundDoseInterface(callback, soundDose));
+ return OK;
}
status_t AudioSystem::getDirectPlaybackSupport(const audio_attributes_t *attr,