Handle AT+CHLD=1 when there is no active call
Use case:
1. Connect to headset/carkit with 3-way calling support.
2. Make an incoming call or put active call on hold.
3. Send AT+CHLD=1 command from remote headset.
Failure:
AG responds with error for AT+CHLD=1 from remote since there is
no active call. Incoming ringing call is not accepted. If there
is a call on hold, it remains on hold.
Root cause:
Since there is no active call, we are returning error instead of
checking for presence of incoming or held call to make it active.
Fix:
When AT+CHLD=1 is received, end the active call if any and accept
the incoming call or make the held call to active if exists.
Change-Id: Idb81507623e26d9760c93b01c4e55ab04a746cef
diff --git a/src/com/android/server/telecom/BluetoothPhoneServiceImpl.java b/src/com/android/server/telecom/BluetoothPhoneServiceImpl.java
index dab4545..ca65abf 100644
--- a/src/com/android/server/telecom/BluetoothPhoneServiceImpl.java
+++ b/src/com/android/server/telecom/BluetoothPhoneServiceImpl.java
@@ -448,15 +448,17 @@
return true;
}
} else if (chld == CHLD_TYPE_RELEASEACTIVE_ACCEPTHELD) {
+ if (activeCall == null && ringingCall == null && heldCall == null)
+ return false;
if (activeCall != null) {
mCallsManager.disconnectCall(activeCall);
- if (ringingCall != null) {
- mCallsManager.answerCall(ringingCall, ringingCall.getVideoState());
- } else if (heldCall != null) {
- mCallsManager.unholdCall(heldCall);
- }
- return true;
}
+ if (ringingCall != null) {
+ mCallsManager.answerCall(ringingCall, ringingCall.getVideoState());
+ } else if (heldCall != null) {
+ mCallsManager.unholdCall(heldCall);
+ }
+ return true;
} else if (chld == CHLD_TYPE_HOLDACTIVE_ACCEPTHELD) {
if (activeCall != null && activeCall.can(Connection.CAPABILITY_SWAP_CONFERENCE)) {
activeCall.swapConference();