HFP: suspend A2DP when call or ring is ongoing
Suspend A2DP when call or ring is ongoing even
though there is no HFP connected device.
CRs-Fixed: 2489030
Change-Id: I4d68c836288bf628aebffe2335c36695da43b993
diff --git a/src/com/android/bluetooth/hfp/HeadsetA2dpSync.java b/src/com/android/bluetooth/hfp/HeadsetA2dpSync.java
index 1b46dd7..8adbdf2 100644
--- a/src/com/android/bluetooth/hfp/HeadsetA2dpSync.java
+++ b/src/com/android/bluetooth/hfp/HeadsetA2dpSync.java
@@ -194,10 +194,9 @@
break;
case BluetoothA2dp.STATE_PLAYING:
mA2dpConnState.put(device, A2DP_PLAYING);
- // if call/ ring is ongoing and there is HFP connected device and we received playing,
+ // if call/ ring is ongoing and we received playing,
// we need to suspend
- if ((mHeadsetService.isInCall() || mHeadsetService.isRinging()) &&
- mHeadsetService.getConnectedDevices().size() != 0) {
+ if (mHeadsetService.isInCall() || mHeadsetService.isRinging()) {
Log.d(TAG," CALL/Ring is active ");
suspendA2DP(A2DP_SUSPENDED_BY_CS_CALL, mDummyDevice);
}
diff --git a/src/com/android/bluetooth/hfp/HeadsetService.java b/src/com/android/bluetooth/hfp/HeadsetService.java
index a06b457..c05b98e 100644
--- a/src/com/android/bluetooth/hfp/HeadsetService.java
+++ b/src/com/android/bluetooth/hfp/HeadsetService.java
@@ -1996,6 +1996,12 @@
Log.i(TAG, "No device is connected and no call, " +
"set A2DPsuspended to false");
mHfpA2dpSyncInterface.releaseA2DP(null);
+ } else {
+ //if call/ ring is ongoing, suspendA2DP to true
+ Log.i(TAG, "No device is connected and call/ring is ongoing, " +
+ "set A2DPsuspended to true");
+ mHfpA2dpSyncInterface.suspendA2DP(HeadsetA2dpSync.
+ A2DP_SUSPENDED_BY_CS_CALL, null);
}
});
}