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

Commit 89f142b5 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

Fix A2DP volume at 0 on connection

A regression on A2DP volume was introduced in the rebase
  of 5885037c
  on top of 9fbc205f
  where the uninitialized arg2 field of the message was
  used as the A2DP volume, whereas the original CL was
  storing the volume information in the BluetoothA2dpDeviceInfo
  object.

Bug: 123554971
Test: play music on speaker, connect A2DP device, verify music not muted
Change-Id: Id14f4c93358cd539ef51d00c806a1562bd6f0008
parent 2d10bd04
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -600,7 +600,7 @@ import java.util.ArrayList;
                    break;
                case MSG_IL_SET_A2DP_SINK_CONNECTION_STATE:
                    mDeviceInventory.onSetA2dpSinkConnectionState(
                            (BtHelper.BluetoothA2dpDeviceInfo) msg.obj, msg.arg1, msg.arg2);
                            (BtHelper.BluetoothA2dpDeviceInfo) msg.obj, msg.arg1);
                    break;
                case MSG_IL_SET_A2DP_SOURCE_CONNECTION_STATE:
                    mDeviceInventory.onSetA2dpSourceConnectionState(
+5 −3
Original line number Diff line number Diff line
@@ -147,18 +147,20 @@ public final class AudioDeviceInventory {
    }

    /*package*/ void onSetA2dpSinkConnectionState(@NonNull BtHelper.BluetoothA2dpDeviceInfo btInfo,
            @AudioService.BtProfileConnectionState int state, int a2dpVolume) {
            @AudioService.BtProfileConnectionState int state) {
        final BluetoothDevice btDevice = btInfo.getBtDevice();
        int a2dpVolume = btInfo.getVolume();
        if (AudioService.DEBUG_DEVICES) {
            Log.d(TAG, "onSetA2dpSinkConnectionState btDevice=" + btDevice + " state="
                    + state + " is dock=" + btDevice.isBluetoothDock());
                    + state + " is dock=" + btDevice.isBluetoothDock() + " vol=" + a2dpVolume);
        }
        String address = btDevice.getAddress();
        if (!BluetoothAdapter.checkBluetoothAddress(address)) {
            address = "";
        }
        AudioService.sDeviceLogger.log(new AudioEventLogger.StringEvent(
                "A2DP sink connected: device addr=" + address + " state=" + state));
                "A2DP sink connected: device addr=" + address + " state=" + state
                        + " vol=" + a2dpVolume));

        final int a2dpCodec;
        synchronized (mDeviceBroker.mA2dpAvrcpLock) {