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

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

Set correct max vol curve index for LEA

There could be an index mismatch between APM and AS if we do not set the
correct max vol curve index for LEA devices. This could end up in
suppressed volume commands to APM.

Test: manual
Bug: 435150134
Flag: EXEMPT bugfix
Change-Id: Icf6c9a6b7a4cc34b2156e40bcf296454f60b87f4
parent 5bfce90a
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -10086,19 +10086,28 @@ public class AudioService extends IAudioService.Stub
                        mIndexStepFactor = 1.f;
                    } else if ((equalScoLeaVcIndexRange() || equalScoHaVcIndexRange())
                            && isStreamBluetoothComm(mStreamType)) {
                        final int btCommActiveDevice = mBtCommDeviceActive.get();
                        // For non SCO devices the stream state does not change the min index
                        if (mBtCommDeviceActive.get() == BT_COMM_DEVICE_ACTIVE_SCO) {
                        if (btCommActiveDevice == 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 if (equalScoHaVcIndexRange()
                                && mBtCommDeviceActive.get() == BT_COMM_DEVICE_ACTIVE_HA) {
                            mIndexStepFactor = 1.f;
                        } else if ((equalScoHaVcIndexRange()
                                && btCommActiveDevice == BT_COMM_DEVICE_ACTIVE_HA) || (
                                equalScoLeaVcIndexRange() && (btCommActiveDevice
                                        == BT_COMM_DEVICE_ACTIVE_BLE_HEADSET
                                        || btCommActiveDevice
                                        == BT_COMM_DEVICE_ACTIVE_BLE_SPEAKER))) {
                            mIndexMin = MIN_STREAM_VOLUME[mStreamType] * 10;
                            indexMaxVolCurve = MAX_STREAM_VOLUME[AudioSystem.STREAM_BLUETOOTH_SCO];
                            mIndexStepFactor = 1.f;
                        } else {
                            Slog.wtf(TAG, "Index factor not supported for BT comm device "
                                    + btCommActiveDevice);
                            mIndexMin = MIN_STREAM_VOLUME[mStreamType] * 10;
                        }
                        mIndexStepFactor = 1.f;
                    } else {
                        mIndexMin = MIN_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] * 10;
                        mIndexStepFactor = (float) (mIndexMax - mIndexMin) / (float) (