CSD: forward the native MEL exposure to AudioService
Added new aidl interface for the communication between the
SoundDoseManager and the SoundDoseHelper. Currently only the momentary
exposure warning is reported.
Test: manual
Bug: 257238734
Change-Id: I61560f81fedd31c30c39d676b7adf0ce087b495c
diff --git a/services/audioflinger/sounddose/SoundDoseManager.cpp b/services/audioflinger/sounddose/SoundDoseManager.cpp
index 0a69c52..86fb3a4 100644
--- a/services/audioflinger/sounddose/SoundDoseManager.cpp
+++ b/services/audioflinger/sounddose/SoundDoseManager.cpp
@@ -123,6 +123,23 @@
__func__,
deviceId,
currentMel);
+
+ sp<media::ISoundDoseCallback> soundDoseCallback;
+ {
+ std::lock_guard _l(mLock);
+ soundDoseCallback = mSoundDoseCallback;
+ }
+
+ if (soundDoseCallback != nullptr) {
+ mSoundDoseCallback->onMomentaryExposure(currentMel, deviceId);
+ }
+}
+
+void SoundDoseManager::registerSoundDoseCallback(const sp<media::ISoundDoseCallback>& callback) {
+ ALOGV("%s: Register ISoundDoseCallback", __func__);
+
+ std::lock_guard _l(mLock);
+ mSoundDoseCallback = callback;
}
std::string SoundDoseManager::dump() const