A2dp: add handle for connected status event.

When Bluetooth is reenabled, Src peer and Snk peer can be at the connecting status at the same time,
that would cause both Src and Snk devices got connected. Add handle for connected status event can
avoid such cases.

CRs-Fixed: 2475478
Change-Id: Ie9743755d1bfcdd4e4e43dc28704b1459bbd05f2
diff --git a/src/com/android/bluetooth/a2dp/A2dpService.java b/src/com/android/bluetooth/a2dp/A2dpService.java
index f2289cc..721810e 100644
--- a/src/com/android/bluetooth/a2dp/A2dpService.java
+++ b/src/com/android/bluetooth/a2dp/A2dpService.java
@@ -1145,7 +1145,8 @@
                 return;
             }
             if (mA2dpSrcSnkConcurrency &&
-                A2dpStackEvent.CONNECTION_STATE_CONNECTING == stackEvent.valueInt) {
+                ( A2dpStackEvent.CONNECTION_STATE_CONNECTING == stackEvent.valueInt ||
+                  A2dpStackEvent.CONNECTION_STATE_CONNECTED == stackEvent.valueInt )) {
                 sA2dpSinkService = A2dpSinkService.getA2dpSinkService();
                 List<BluetoothDevice> srcDevs = sA2dpSinkService.getConnectedDevices();
                 for ( BluetoothDevice src : srcDevs ) {
diff --git a/src/com/android/bluetooth/a2dpsink/A2dpSinkService.java b/src/com/android/bluetooth/a2dpsink/A2dpSinkService.java
index a27f187..8a45ced 100644
--- a/src/com/android/bluetooth/a2dpsink/A2dpSinkService.java
+++ b/src/com/android/bluetooth/a2dpsink/A2dpSinkService.java
@@ -642,7 +642,8 @@
         event.device = device;
         event.valueInt = state;
         if (mA2dpSrcSnkConcurrency &&
-            state == BluetoothProfile.STATE_CONNECTING) {
+            (state == BluetoothProfile.STATE_CONNECTING ||
+             state == BluetoothProfile.STATE_CONNECTED)) {
             sA2dpService = A2dpService.getA2dpService();
             List<BluetoothDevice> snkDevs = sA2dpService.getConnectedDevices();
             for ( BluetoothDevice snk : snkDevs ) {