Check size of connected devices array for A2DP
A2dp can return array of size 0, if no A2DP devices is connected.
Without this check,A2DP status is set to true.
This results in FM audio failure.
Change-Id: Ib5976a50a4477f60339a954ed923d0719924b1ca
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 6554c90..0b7a366 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -3741,11 +3741,11 @@
public void onServiceConnected(int profile, BluetoothProfile proxy) {
mA2dpProfile = (BluetoothA2dp) proxy;
mA2dpDeviceList = mA2dpProfile.getConnectedDevices();
-
- if (mA2dpDeviceList.isEmpty())
+ if (mA2dpDeviceList == null || mA2dpDeviceList.size() == 0)
mA2dpConnected = false;
else
mA2dpConnected = true;
+
mA2dpDisconnected = !mA2dpConnected;
mSpeakerPhoneOn = mA2dpConnected;
Log.d(LOGTAG, "A2DP Status: " + mA2dpConnected);