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

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

AudioService: fix A2DP disconnection / reconnection

Fix issue introduced by commit d32a94d2 where in case of an
A2DP disconnection, the device was disconnected then reconnected.

Bug: 146544156
Test: disconnect A2DP device, check it's not listed in dumpsys media.audio_policy
Change-Id: Ic5f9387194d92a7a050e7a295a13a9ae18cd96ce
parent bdc46599
Loading
Loading
Loading
Loading
+10 −8
Original line number Original line Diff line number Diff line
@@ -195,7 +195,8 @@ public class AudioDeviceInventory {
                } else {
                } else {
                    makeA2dpDeviceUnavailableNow(address, di.mDeviceCodecFormat);
                    makeA2dpDeviceUnavailableNow(address, di.mDeviceCodecFormat);
                }
                }
            }
            } else if (state == BluetoothProfile.STATE_CONNECTED) {
                // device is not already connected
                if (a2dpVolume != -1) {
                if (a2dpVolume != -1) {
                    mDeviceBroker.postSetVolumeIndexOnDevice(AudioSystem.STREAM_MUSIC,
                    mDeviceBroker.postSetVolumeIndexOnDevice(AudioSystem.STREAM_MUSIC,
                            // convert index to internal representation in VolumeStreamState
                            // convert index to internal representation in VolumeStreamState
@@ -206,6 +207,7 @@ public class AudioDeviceInventory {
                        "onSetA2dpSinkConnectionState", a2dpCodec);
                        "onSetA2dpSinkConnectionState", a2dpCodec);
            }
            }
        }
        }
    }


    /*package*/ void onSetA2dpSourceConnectionState(
    /*package*/ void onSetA2dpSourceConnectionState(
            @NonNull BtHelper.BluetoothA2dpDeviceInfo btInfo, int state) {
            @NonNull BtHelper.BluetoothA2dpDeviceInfo btInfo, int state) {