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

Commit 653f18a9 authored by Vlad Popa's avatar Vlad Popa
Browse files

CSD: Fix resetting the sound dose binder interface

Flag: EXEMPT bugfix
Test: kill audio server and check interface
Bug: 342526946
Change-Id: Ic7ce3f9fa19c923fa69bc7cec79d1728ab68e75e
Merged-In: Ic7ce3f9fa19c923fa69bc7cec79d1728ab68e75e
parent a11d1e29
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1885,7 +1885,6 @@ public class AudioService extends IAudioService.Stub
        }
        mSpatializerHelper.reset(/* featureEnabled */ mHasSpatializerEffect);
        mSoundDoseHelper.reset();
        // Restore rotation information.
        if (mMonitorRotation) {
@@ -1896,6 +1895,8 @@ public class AudioService extends IAudioService.Stub
        // indicate the end of reconfiguration phase to audio HAL
        AudioSystem.setParameters("restarting=false");
        mSoundDoseHelper.reset(/*resetISoundDose=*/true);
        sendMsg(mAudioHandler, MSG_DISPATCH_AUDIO_SERVER_STATE,
                SENDMSG_QUEUE, 1, 0, null, 0);
+5 −4
Original line number Diff line number Diff line
@@ -856,11 +856,12 @@ public class SoundDoseHelper {
        pw.println();
    }

    /*package*/void  reset() {
    /*package*/void reset(boolean resetISoundDose) {
        Log.d(TAG, "Reset the sound dose helper");

        mSoundDose.compareAndExchange(/*expectedValue=*/null,
                AudioSystem.getSoundDoseInterface(mSoundDoseCallback));
        if (resetISoundDose) {
            mSoundDose.set(AudioSystem.getSoundDoseInterface(mSoundDoseCallback));
        }

        synchronized (mCsdStateLock) {
            try {
@@ -972,7 +973,7 @@ public class SoundDoseHelper {
            }
        }

        reset();
        reset(/*resetISoundDose=*/false);
    }

    private void onConfigureSafeMedia(boolean force, String caller) {