Add helper methods for the sound dose test API
Added methods for:
* getOutputRs2: returns the currently used RS2 value by the audioserver
* getCsd: returns the current CSD value from the audioserver
* forceUseFrameworkMel: will enable/disable the computation of the
MEL values by the framework/HAL
* forceComputeCsdOnAllDevice: computes CSD for all output playback
devices.
Test: TestApi
Bug: 248565894
Change-Id: Id34e7e26e57d47ee8ab5a45d08e46b7a3f298ddb
diff --git a/services/audioflinger/sounddose/SoundDoseManager.h b/services/audioflinger/sounddose/SoundDoseManager.h
index b0aa5d6..eb5fa49 100644
--- a/services/audioflinger/sounddose/SoundDoseManager.h
+++ b/services/audioflinger/sounddose/SoundDoseManager.h
@@ -82,6 +82,9 @@
// used for testing
size_t getCachedMelRecordsSize() const;
+ bool useFrameworkMel() const;
+ bool computeCsdOnAllDevices() const;
+
/** Method for converting from audio_utils::CsdRecord to media::SoundDoseRecord. */
static media::SoundDoseRecord csdRecordToSoundDoseRecord(const audio_utils::CsdRecord& legacy);
@@ -107,6 +110,10 @@
binder::Status setOutputRs2(float value) override;
binder::Status resetCsd(float currentCsd,
const std::vector<media::SoundDoseRecord>& records) override;
+ binder::Status getOutputRs2(float* value);
+ binder::Status getCsd(float* value);
+ binder::Status forceUseFrameworkMel(bool useFrameworkMel);
+ binder::Status forceComputeCsdOnAllDevices(bool computeCsdOnAllDevices);
wp<SoundDoseManager> mSoundDoseManager;
const sp<media::ISoundDoseCallback> mSoundDoseCallback;
@@ -117,7 +124,10 @@
void resetCsd(float currentCsd, const std::vector<media::SoundDoseRecord>& records);
sp<media::ISoundDoseCallback> getSoundDoseCallback() const;
-
+
+ void setUseFrameworkMel(bool useFrameworkMel);
+ void setComputeCsdOnAllDevices(bool computeCsdOnAllDevices);
+
mutable std::mutex mLock;
// no need for lock since MelAggregator is thread-safe
@@ -129,6 +139,9 @@
float mRs2Value GUARDED_BY(mLock);
sp<SoundDose> mSoundDose GUARDED_BY(mLock);
+
+ bool mUseFrameworkMel GUARDED_BY(mLock);
+ bool mComputeCsdOnAllDevices GUARDED_BY(mLock);
};
} // namespace android