Skip to content
Snippets Groups Projects
Commit cea6a452 authored by Rahul Sabnis's avatar Rahul Sabnis
Browse files

Fix crash in AdapterService#disconnectAudio due to

ArrayIndexOutOfBoundsException

Tag: #feature
Bug: 214496804
Test: Manual
Merged-In: I76185f21538e38b719b649399af5e15795a34c24
Change-Id: I76185f21538e38b719b649399af5e15795a34c24
parent e0fad4a0
No related branches found
No related tags found
No related merge requests found
......@@ -1485,12 +1485,20 @@ public class HeadsetService extends ProfileService {
}
int disconnectAudio() {
int disconnectResult = BluetoothStatusCodes.ERROR_NO_ACTIVE_DEVICES;
synchronized (mStateMachines) {
List<BluetoothDevice> activeAudioDevices = getNonIdleAudioDevices();
BluetoothDevice activeAudioDevice =
activeAudioDevices.get(activeAudioDevices.size() - 1);
return disconnectAudio(activeAudioDevice);
for (BluetoothDevice device : getNonIdleAudioDevices()) {
disconnectResult = disconnectAudio(device);
if (disconnectResult == BluetoothStatusCodes.SUCCESS) {
return disconnectResult;
} else {
Log.e(TAG, "disconnectAudio() from " + device + " failed with status code "
+ disconnectResult);
}
}
}
logD("disconnectAudio() no active audio connection");
return disconnectResult;
}
int disconnectAudio(BluetoothDevice device) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment