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

Commit 4cfa336c authored by Vlad Popa's avatar Vlad Popa
Browse files

Fix the range of the avrcp index

When sending a new index to change the ACRCP volume make sure that the
range is the same as for STREAM_MUSIC

Test: manual
Bug: 416329698
Flag: EXEMPT bugfix
Change-Id: I8bb8809bb05edb854233c829e05f685983f2ec27
parent 34fa917f
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -4467,11 +4467,16 @@ public class AudioService extends IAudioService.Stub
            if (streamTypeAlias == getBluetoothContextualVolumeStream()
                    && AudioSystem.DEVICE_OUT_ALL_A2DP_SET.contains(deviceType)
                    && (flags & AudioManager.FLAG_BLUETOOTH_ABS_VOLUME) == 0) {
                // the AVRCP index is always in the range of STREAM_MUSIC
                int avrcpIndex = newIndex / 10;
                if (streamType != AudioSystem.STREAM_MUSIC) {
                    avrcpIndex = rescaleIndex(avrcpIndex, streamType, AudioSystem.STREAM_MUSIC);
                }
                if (DEBUG_VOL) {
                    Log.d(TAG, "adjustStreamVolume: postSetAvrcpAbsoluteVolumeIndex index="
                            + newIndex + "stream=" + streamType);
                            + newIndex + "stream=" + streamType + "avrcpIndex=" + avrcpIndex);
                }
                mDeviceBroker.postSetAvrcpAbsoluteVolumeIndex(newIndex / 10);
                mDeviceBroker.postSetAvrcpAbsoluteVolumeIndex(avrcpIndex);
                volumeHandled = true;
            }