CSD: extract SoundDoseManager for MEL handling

The SoundDoseManager owns the aggregator which computes the sound dose.
This is a central place for passing the sound dose properties up to the
higher layers.

Test: UT and dumpsys media.audio_flinger
Bug: 255943034

Change-Id: I2d8139b9115bdd793d4ed418f2da6bc8782d32b3
diff --git a/services/audioflinger/MelReporter.h b/services/audioflinger/MelReporter.h
index 905a4cd..8a78f6e 100644
--- a/services/audioflinger/MelReporter.h
+++ b/services/audioflinger/MelReporter.h
@@ -19,8 +19,9 @@
     #error This header file should only be included from AudioFlinger.h
 #endif
 
-#include <unordered_map>
 #include <mutex>
+#include <sounddose/SoundDoseManager.h>
+#include <unordered_map>
 
 constexpr static int kMaxTimestampDeltaInSec = 120;
 
@@ -31,8 +32,7 @@
 class MelReporter : public PatchCommandThread::PatchCommandListener {
 public:
     explicit MelReporter(AudioFlinger& audioFlinger)
-        : mAudioFlinger(audioFlinger),
-          mMelAggregator(kMaxTimestampDeltaInSec) {}
+        : mAudioFlinger(audioFlinger) {}
 
     void onFirstRef() override {
         mAudioFlinger.mPatchCommandThread->addListener(this);
@@ -54,7 +54,7 @@
 private:
     AudioFlinger& mAudioFlinger;  // does not own the object
 
-    audio_utils::MelAggregator mMelAggregator;
+    SoundDoseManager mSoundDoseManager;
 
     struct ActiveMelPatch {
         audio_io_handle_t streamHandle{AUDIO_IO_HANDLE_NONE};