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

Commit e7ac38b5 authored by Vlad Popa's avatar Vlad Popa Committed by Android (Google) Code Review
Browse files

Merge "CSD: attenuation log update" into main

parents 69cafe0e 2ad70195
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -900,8 +900,10 @@ public class SoundDoseHelper {

        try {
            if (!isAbsoluteVolume) {
                mLogger.enqueue(
                        SoundDoseEvent.getAbsVolumeAttenuationEvent(/*attenuation=*/0.f, device));
                if (mSafeMediaVolumeDevices.indexOfKey(device) >= 0) {
                    mLogger.enqueue(SoundDoseEvent.getAbsVolumeAttenuationEvent(/*attenuation=*/0.f,
                            device));
                }
                // remove any possible previous attenuation
                soundDose.updateAttenuation(/* attenuationDB= */0.f, device);

@@ -912,8 +914,12 @@ public class SoundDoseHelper {
                    && safeDevicesContains(device)) {
                float attenuationDb = -AudioSystem.getStreamVolumeDB(AudioSystem.STREAM_MUSIC,
                        (newIndex + 5) / 10, device);

                if (mSafeMediaVolumeDevices.indexOfKey(device) >= 0) {
                    mLogger.enqueue(
                            SoundDoseEvent.getAbsVolumeAttenuationEvent(attenuationDb, device));
                }

                soundDose.updateAttenuation(attenuationDb, device);
            }
        } catch (RemoteException e) {