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

Commit 750ecb9b authored by Vlad Popa's avatar Vlad Popa
Browse files

CSD: clean up sound dose test API

With the removal of GMS requirement for IEC62368-1 10.6.5 we do not need
to test the safe hearing volume logic together with sound dose anymore.
Whenever sound dose is enable we will disable the safe hearing volume
implementation.

Test: atest SoundDoseTest SoundDoseInteractiveTest
Bug: 280748088
Change-Id: Ib901bd002ca242999c893c0533eec7ea6a6c4016
parent b98116ac
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
@@ -174,9 +174,6 @@ public class SoundDoseHelper {
     */
    private final SparseIntArray mSafeMediaVolumeDevices = new SparseIntArray();

    /** Used for testing to enforce safe media on all devices */
    private boolean mForceSafeMediaOnAllDevices = false;

    // mMusicActiveMs is the cumulative time of music activity since safe volume was disabled.
    // When this time reaches UNSAFE_VOLUME_MUSIC_ACTIVE_MS_MAX, the safe media volume is re-enabled
    // automatically. mMusicActiveMs is rounded to a multiple of MUSIC_ACTIVE_POLL_PERIOD_MS.
@@ -430,12 +427,6 @@ public class SoundDoseHelper {
            return;
        }

        synchronized (mSafeMediaVolumeStateLock) {
            mSafeMediaVolumeState = SAFE_MEDIA_VOLUME_ACTIVE;
            mMusicActiveMs = 0;
            saveMusicActiveMs();
        }

        synchronized (mCsdStateLock) {
            mLastMomentaryExposureTimeMs = MOMENTARY_EXPOSURE_TIMEOUT_UNINITIALIZED;
        }
@@ -475,8 +466,6 @@ public class SoundDoseHelper {
        } catch (RemoteException e) {
            Log.e(TAG, "Exception while forcing CSD computation on all devices", e);
        }

        mForceSafeMediaOnAllDevices = computeCsdOnAllDevices;
    }

    boolean isCsdEnabled() {
@@ -559,7 +548,7 @@ public class SoundDoseHelper {
    private boolean checkSafeMediaVolume_l(int streamType, int index, int device) {
        return (mSafeMediaVolumeState == SAFE_MEDIA_VOLUME_ACTIVE)
                    && (AudioService.mStreamVolumeAlias[streamType] == AudioSystem.STREAM_MUSIC)
                    && (safeDevicesContains(device) || mForceSafeMediaOnAllDevices)
                    && safeDevicesContains(device)
                    && (index > safeMediaVolumeIndex(device));
    }