diff options
| author | 2024-11-13 19:13:29 -0800 | |
|---|---|---|
| committer | 2024-11-14 16:30:50 -0800 | |
| commit | ff44d0d7271e4581df95d81bace23ac4b30cb504 (patch) | |
| tree | bf00efa61cc250b0d79649dd4371562dad42b6be | |
| parent | e5d7a587f7c2d9114973cd595d9b9199d97492ef (diff) | |
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
| -rw-r--r-- | services/core/java/com/android/server/audio/AudioService.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index 6ba356990cac..5f716605e8cd 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -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:" |