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

Commit fece923d authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Automerger Merge Worker
Browse files

Merge "AudioService: fix AVRCP absolute volume reset" into sc-dev am: 3009a4d8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14516147

Change-Id: I06e68ed7de6b20b488a256bf9cb90bae21895b7c
parents 2eaac8e7 3009a4d8
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -1034,6 +1034,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
        }
        }
    }
    }


    /*package*/ void clearAvrcpAbsoluteVolumeSupported() {
        setAvrcpAbsoluteVolumeSupported(false);
        mAudioService.setAvrcpAbsoluteVolumeSupported(false);
    }

    /*package*/ boolean getBluetoothA2dpEnabled() {
    /*package*/ boolean getBluetoothA2dpEnabled() {
        synchronized (mDeviceStateLock) {
        synchronized (mDeviceStateLock) {
            return mBluetoothA2dpEnabled;
            return mBluetoothA2dpEnabled;
+1 −1
Original line number Original line Diff line number Diff line
@@ -1015,7 +1015,7 @@ public class AudioDeviceInventory {
        }
        }


        // device to remove was visible by APM, update APM
        // device to remove was visible by APM, update APM
        mDeviceBroker.setAvrcpAbsoluteVolumeSupported(false);
        mDeviceBroker.clearAvrcpAbsoluteVolumeSupported();
        final int res = mAudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
        final int res = mAudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
                AudioSystem.DEVICE_STATE_UNAVAILABLE, address, "", a2dpCodec);
                AudioSystem.DEVICE_STATE_UNAVAILABLE, address, "", a2dpCodec);


+5 −1
Original line number Original line Diff line number Diff line
@@ -7647,8 +7647,12 @@ public class AudioService extends IAudioService.Stub
        // address is not used for now, but may be used when multiple a2dp devices are supported
        // address is not used for now, but may be used when multiple a2dp devices are supported
        sVolumeLogger.log(new AudioEventLogger.StringEvent("avrcpSupportsAbsoluteVolume addr="
        sVolumeLogger.log(new AudioEventLogger.StringEvent("avrcpSupportsAbsoluteVolume addr="
                + address + " support=" + support));
                + address + " support=" + support));
        mAvrcpAbsVolSupported = support;
        mDeviceBroker.setAvrcpAbsoluteVolumeSupported(support);
        mDeviceBroker.setAvrcpAbsoluteVolumeSupported(support);
        setAvrcpAbsoluteVolumeSupported(support);
    }

    /*package*/ void setAvrcpAbsoluteVolumeSupported(boolean support) {
        mAvrcpAbsVolSupported = support;
        sendMsg(mAudioHandler, MSG_SET_DEVICE_VOLUME, SENDMSG_QUEUE,
        sendMsg(mAudioHandler, MSG_SET_DEVICE_VOLUME, SENDMSG_QUEUE,
                    AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, 0,
                    AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, 0,
                    mStreamStates[AudioSystem.STREAM_MUSIC], 0);
                    mStreamStates[AudioSystem.STREAM_MUSIC], 0);