AudioManager: fix isBluetoothA2dpOn()

Test all A2DP type variants when checking if an A2DP device is connected
in isBluetoothA2dpOn().

Bug: 28286051
Change-Id: I756d632b12d584d8a27cc1890e758d8accff7120
This commit is contained in:
Eric Laurent
2016-04-20 16:42:28 -07:00
parent e6be9c58cc
commit 9656df2b2e

View File

@@ -1502,11 +1502,16 @@ public class AudioManager {
*/
public boolean isBluetoothA2dpOn() {
if (AudioSystem.getDeviceConnectionState(DEVICE_OUT_BLUETOOTH_A2DP,"")
== AudioSystem.DEVICE_STATE_UNAVAILABLE) {
return false;
} else {
== AudioSystem.DEVICE_STATE_AVAILABLE) {
return true;
} else if (AudioSystem.getDeviceConnectionState(DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES,"")
== AudioSystem.DEVICE_STATE_AVAILABLE) {
return true;
} else if (AudioSystem.getDeviceConnectionState(DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER,"")
== AudioSystem.DEVICE_STATE_AVAILABLE) {
return true;
}
return false;
}
/**