CSD: Add logic for forcing the use of internal MEL

This flag should be used for testing purposes only. Sometimes it might
make sense to disable the HAL sound dose interface to test the internal
MEL computation and sound dose logic end-2-end.

Test: sounddosemanager_tests UT
Bug: 248565894
Change-Id: Ieaf506511c0aee3b9a5a262831b950d9dcaf3535
diff --git a/services/audioflinger/sounddose/SoundDoseManager.h b/services/audioflinger/sounddose/SoundDoseManager.h
index 199e8c9..b10874f 100644
--- a/services/audioflinger/sounddose/SoundDoseManager.h
+++ b/services/audioflinger/sounddose/SoundDoseManager.h
@@ -104,11 +104,10 @@
 
     std::string dump() const;
 
-    // used for testing
+    // used for testing only
     size_t getCachedMelRecordsSize() const;
-    bool useFrameworkMel() const;
-    bool computeCsdOnAllDevices() const;
-
+    bool forceUseFrameworkMel() const;
+    bool forceComputeCsdOnAllDevices() const;
 
     /** Method for converting from audio_utils::CsdRecord to media::SoundDoseRecord. */
     static media::SoundDoseRecord csdRecordToSoundDoseRecord(const audio_utils::CsdRecord& legacy);
@@ -166,6 +165,8 @@
 
     void setUseFrameworkMel(bool useFrameworkMel);
     void setComputeCsdOnAllDevices(bool computeCsdOnAllDevices);
+    /** Returns the HAL sound dose interface or null if internal MEL computation is used. */
+    void getHalSoundDose(std::shared_ptr<ISoundDose>* halSoundDose) const;
 
     mutable std::mutex mLock;
 
@@ -185,8 +186,8 @@
     std::shared_ptr<ISoundDose> mHalSoundDose GUARDED_BY(mLock);
     std::shared_ptr<HalSoundDoseCallback> mHalSoundDoseCallback GUARDED_BY(mLock);
 
-    bool mUseFrameworkMel GUARDED_BY(mLock);
-    bool mComputeCsdOnAllDevices GUARDED_BY(mLock);
+    bool mUseFrameworkMel GUARDED_BY(mLock) = false;
+    bool mComputeCsdOnAllDevices GUARDED_BY(mLock) = false;
 };
 
 }  // namespace android