Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b380757 authored by Vlad Popa's avatar Vlad Popa
Browse files

Do not reset HAL interfaces when using internal MELs

Using internal MELs is a test functionality. If the HAL interfaces are
deleted there is no way of getting them back after the end of the test.
Keep the HAL interfaces but ignore the received values when testing with
internal MELs

Test: atest SoundDoseTest
Bug: 315887200
Change-Id: Iaaff1a7762bd58d32e2191f15a5fcfe09f6e5af9
parent ec79adf2
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ sp<audio_utils::MelProcessor> SoundDoseManager::getOrCreateProcessorForDevice(
        size_t channelCount, audio_format_t format) {
    const std::lock_guard _l(mLock);

    if (mHalSoundDose.size() > 0 && mEnabledCsd) {
    if (!mUseFrameworkMel && mHalSoundDose.size() > 0 && mEnabledCsd) {
        ALOGD("%s: using HAL MEL computation, no MelProcessor needed.", __func__);
        return nullptr;
    }
@@ -143,7 +143,7 @@ void SoundDoseManager::setOutputRs2UpperBound(float rs2Value) {
    ALOGV("%s", __func__);
    const std::lock_guard _l(mLock);

    if (mHalSoundDose.size() > 0) {
    if (!mUseFrameworkMel && mHalSoundDose.size() > 0) {
        bool success = true;
        for (auto& halSoundDose : mHalSoundDose) {
            // using the HAL sound dose interface
@@ -549,9 +549,6 @@ bool SoundDoseManager::shouldComputeCsdForDeviceWithAddress(const audio_devices_
}

void SoundDoseManager::setUseFrameworkMel(bool useFrameworkMel) {
    // invalidate any HAL sound dose interface used
    resetHalSoundDoseInterfaces();

    const std::lock_guard _l(mLock);
    mUseFrameworkMel = useFrameworkMel;
}
@@ -582,7 +579,7 @@ bool SoundDoseManager::isSoundDoseHalSupported() const {

bool SoundDoseManager::useHalSoundDose() const {
    const std::lock_guard _l(mLock);
    return mHalSoundDose.size() > 0;
    return !mUseFrameworkMel && mHalSoundDose.size() > 0;
}

void SoundDoseManager::resetSoundDose() {