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

Commit ff44d0d7 authored by Vlad Popa's avatar Vlad Popa
Browse files

Fix voice volume min/max mismatch with APM curves

The idea is to keep the original min/max of the volume curves and apply
the factor before sending the index to APM

Test: check APM verbose logs
Bug: 378777462
Flag: EXEMPT bugfix
Change-Id: I71580d393365ea680e6958042afd6aa68a9fa845
parent e5d7a587
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -9224,6 +9224,9 @@ public class AudioService extends IAudioService.Stub
                return;
            }
            // index values sent to APM are in the stream type SDK range, not *10
            int indexMinVolCurve = MIN_STREAM_VOLUME[mStreamType];
            int indexMaxVolCurve = MAX_STREAM_VOLUME[mStreamType];
            synchronized (this) {
                if (mStreamType == AudioSystem.STREAM_VOICE_CALL) {
                    if (MAX_STREAM_VOLUME[AudioSystem.STREAM_BLUETOOTH_SCO]
@@ -9234,11 +9237,15 @@ public class AudioService extends IAudioService.Stub
                    if (!equalScoLeaVcIndexRange() && isStreamBluetoothSco(mStreamType)) {
                        // SCO devices have a different min index
                        mIndexMin = MIN_STREAM_VOLUME[AudioSystem.STREAM_BLUETOOTH_SCO] * 10;
                        indexMinVolCurve = MIN_STREAM_VOLUME[AudioSystem.STREAM_BLUETOOTH_SCO];
                        indexMaxVolCurve = MAX_STREAM_VOLUME[AudioSystem.STREAM_BLUETOOTH_SCO];
                        mIndexStepFactor = 1.f;
                    } else if (equalScoLeaVcIndexRange() && isStreamBluetoothComm(mStreamType)) {
                        // For non SCO devices the stream state does not change the min index
                        if (mBtCommDeviceActive.get() == BT_COMM_DEVICE_ACTIVE_SCO) {
                            mIndexMin = MIN_STREAM_VOLUME[AudioSystem.STREAM_BLUETOOTH_SCO] * 10;
                            indexMinVolCurve = MIN_STREAM_VOLUME[AudioSystem.STREAM_BLUETOOTH_SCO];
                            indexMaxVolCurve = MAX_STREAM_VOLUME[AudioSystem.STREAM_BLUETOOTH_SCO];
                        } else {
                            mIndexMin = MIN_STREAM_VOLUME[mStreamType] * 10;
                        }
@@ -9259,7 +9266,7 @@ public class AudioService extends IAudioService.Stub
            }
            final int status = AudioSystem.initStreamVolume(
                    mStreamType, mIndexMin / 10, mIndexMax / 10);
                    mStreamType, indexMinVolCurve, indexMaxVolCurve);
            sVolumeLogger.enqueue(new EventLogger.StringEvent(
                    "updateIndexFactors() stream:" + mStreamType + " index min/max:"
                            + mIndexMin / 10 + "/" + mIndexMax / 10 + " indexStepFactor:"