CSD: enable sound dose with internal MEL

Test: logs and dumpsys
Bug: 268035692
Change-Id: I0dd8ca5f8c925d984a782293bba1a7be121fca7c
diff --git a/services/audioflinger/MelReporter.cpp b/services/audioflinger/MelReporter.cpp
index 52af56f..c5c9652 100644
--- a/services/audioflinger/MelReporter.cpp
+++ b/services/audioflinger/MelReporter.cpp
@@ -81,6 +81,10 @@
 }
 
 bool AudioFlinger::MelReporter::shouldComputeMelForDeviceType(audio_devices_t device) {
+    if (mSoundDoseManager->isCsdDisabled()) {
+        ALOGV("%s csd is disabled", __func__);
+        return false;
+    }
     if (mSoundDoseManager->forceComputeCsdOnAllDevices()) {
         return true;
     }
@@ -102,6 +106,11 @@
 
 void AudioFlinger::MelReporter::updateMetadataForCsd(audio_io_handle_t streamHandle,
         const std::vector<playback_track_metadata_v7_t>& metadataVec) {
+    if (mSoundDoseManager->isCsdDisabled()) {
+        ALOGV("%s csd is disabled", __func__);
+        return;
+    }
+
     std::lock_guard _laf(mAudioFlinger.mLock);
     std::lock_guard _l(mLock);
     auto activeMelPatchId = activePatchStreamHandle_l(streamHandle);
@@ -133,6 +142,10 @@
 
 void AudioFlinger::MelReporter::onCreateAudioPatch(audio_patch_handle_t handle,
         const PatchPanel::Patch& patch) {
+    if (mSoundDoseManager->isCsdDisabled()) {
+        ALOGV("%s csd is disabled", __func__);
+        return;
+    }
     if (useHalSoundDoseInterface()) {
         ALOGV("%s using HAL sound dose, ignore new patch", __func__);
         return;
@@ -193,6 +206,11 @@
 }
 
 void AudioFlinger::MelReporter::onReleaseAudioPatch(audio_patch_handle_t handle) {
+    if (mSoundDoseManager->isCsdDisabled()) {
+        ALOGV("%s csd is disabled", __func__);
+        return;
+    }
+
     ActiveMelPatch melPatch;
     {
         std::lock_guard _l(mLock);