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/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 0719838..6505698 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -229,7 +229,7 @@
BINDER_METHOD_ENTRY(setDeviceConnectedState) \
BINDER_METHOD_ENTRY(setRequestedLatencyMode) \
BINDER_METHOD_ENTRY(getSupportedLatencyModes) \
-BINDER_METHOD_ENTRY(registerSoundDoseCallback) \
+BINDER_METHOD_ENTRY(getSoundDoseInterface) \
// singleton for Binder Method Statistics for IAudioFlinger
static auto& getIAudioFlingerStatistics() {
@@ -1657,8 +1657,13 @@
return thread->getSupportedLatencyModes(modes);
}
-status_t AudioFlinger::registerSoundDoseCallback(const sp<media::ISoundDoseCallback>& callback) {
- mMelReporter->registerSoundDoseCallback(callback);
+status_t AudioFlinger::getSoundDoseInterface(const sp<media::ISoundDoseCallback>& callback,
+ sp<media::ISoundDose>* soundDose) {
+ if (soundDose == nullptr) {
+ return BAD_VALUE;
+ }
+
+ *soundDose = mMelReporter->getSoundDoseInterface(callback);
return NO_ERROR;
}
@@ -4618,7 +4623,7 @@
case TransactionCode::SET_MASTER_VOLUME:
case TransactionCode::SET_MASTER_MUTE:
case TransactionCode::MASTER_MUTE:
- case TransactionCode::REGISTER_SOUND_DOSE_CALLBACK:
+ case TransactionCode::GET_SOUND_DOSE_INTERFACE:
case TransactionCode::SET_MODE:
case TransactionCode::SET_MIC_MUTE:
case TransactionCode::SET_LOW_RAM_DEVICE: