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

Commit 1a231f5f authored by Eric Laurent's avatar Eric Laurent Committed by Android Git Automerger
Browse files

am e661b541: am 7791b84c: Merge "AudioService: fix notifications with A2DP abs volume" into klp-dev

* commit 'e661b541':
  AudioService: fix notifications with A2DP abs volume
parents b1b0266d e661b541
Loading
Loading
Loading
Loading
+18 −7
Original line number Diff line number Diff line
@@ -2913,12 +2913,10 @@ public class AudioService extends IAudioService.Stub {
            int index;
            if (isMuted()) {
                index = 0;
            } else if (mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_MUSIC &&
                       (device & AudioSystem.DEVICE_OUT_ALL_A2DP) != 0 &&
            } else if ((device & AudioSystem.DEVICE_OUT_ALL_A2DP) != 0 &&
                       mAvrcpAbsVolSupported) {
                index = (mIndexMax + 5)/10;
            }
            else {
            } else {
                index = (getIndex(device) + 5)/10;
            }
            AudioSystem.setStreamVolumeIndex(mStreamType, index, device);
@@ -2943,6 +2941,9 @@ public class AudioService extends IAudioService.Stub {
                if (device != AudioSystem.DEVICE_OUT_DEFAULT) {
                    if (isMuted()) {
                        index = 0;
                    } else if ((device & AudioSystem.DEVICE_OUT_ALL_A2DP) != 0 &&
                            mAvrcpAbsVolSupported) {
                        index = (mIndexMax + 5)/10;
                    } else {
                        index = ((Integer)entry.getValue() + 5)/10;
                    }
@@ -3215,7 +3216,14 @@ public class AudioService extends IAudioService.Stub {
            for (int streamType = numStreamTypes - 1; streamType >= 0; streamType--) {
                if (streamType != streamState.mStreamType &&
                        mStreamVolumeAlias[streamType] == streamState.mStreamType) {
                    mStreamStates[streamType].applyDeviceVolume(getDeviceForStream(streamType));
                    // Make sure volume is also maxed out on A2DP device for aliased stream
                    // that may have a different device selected
                    int streamDevice = getDeviceForStream(streamType);
                    if ((device != streamDevice) && mAvrcpAbsVolSupported &&
                            ((device & AudioSystem.DEVICE_OUT_ALL_A2DP) != 0)) {
                        mStreamStates[streamType].applyDeviceVolume(device);
                    }
                    mStreamStates[streamType].applyDeviceVolume(streamDevice);
                }
            }

@@ -3843,9 +3851,12 @@ public class AudioService extends IAudioService.Stub {
        // address is not used for now, but may be used when multiple a2dp devices are supported
        synchronized (mA2dpAvrcpLock) {
            mAvrcpAbsVolSupported = support;
            VolumeStreamState streamState = mStreamStates[AudioSystem.STREAM_MUSIC];
            sendMsg(mAudioHandler, MSG_SET_DEVICE_VOLUME, SENDMSG_QUEUE,
                    AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, 0, streamState, 0);
                    AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, 0,
                    mStreamStates[AudioSystem.STREAM_MUSIC], 0);
            sendMsg(mAudioHandler, MSG_SET_DEVICE_VOLUME, SENDMSG_QUEUE,
                    AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, 0,
                    mStreamStates[AudioSystem.STREAM_RING], 0);
        }
    }