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

Commit f273fe47 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "CSD: fix setting rs2 to invalid value" into main

parents 91ccc1b5 845b3662
Loading
Loading
Loading
Loading
+11 −2
Original line number Original line Diff line number Diff line
@@ -144,15 +144,24 @@ void SoundDoseManager::setOutputRs2UpperBound(float rs2Value) {
    const std::lock_guard _l(mLock);
    const std::lock_guard _l(mLock);


    if (mHalSoundDose.size() > 0) {
    if (mHalSoundDose.size() > 0) {
        bool success = true;
        for (auto& halSoundDose : mHalSoundDose) {
        for (auto& halSoundDose : mHalSoundDose) {
            // using the HAL sound dose interface
            // using the HAL sound dose interface
            if (!halSoundDose.second->setOutputRs2UpperBound(rs2Value).isOk()) {
            if (!halSoundDose.second->setOutputRs2UpperBound(rs2Value).isOk()) {
                ALOGE("%s: Cannot set RS2 value for momentary exposure %f", __func__, rs2Value);
                ALOGE("%s: Cannot set RS2 value for momentary exposure %f", __func__, rs2Value);
                continue;
                success = false;
                break;
            }
            }
        }
        }


        if (success) {
            mRs2UpperBound = rs2Value;
            mRs2UpperBound = rs2Value;
        } else {
            // restore all RS2 upper bounds to the previous value
            for (auto& halSoundDose : mHalSoundDose) {
                halSoundDose.second->setOutputRs2UpperBound(mRs2UpperBound);
            }
        }
        return;
        return;
    }
    }