Bug 993288 - Separate BTHF_CALL_STATE_INCOMING and BTHF_CALL_STATE_WAITING for CLCC response only, for other cases, use BTHF_CALL_STATE_INCOMING for both states. r=echou
authorJocelyn Liu <joliu@mozilla.com>
Thu, 17 Apr 2014 16:55:45 +0800
changeset 179848 dc482bcf17e0bd7fe333cec5fc922c30cc26cb8e
parent 179847 3f77f408d0d3ac9668725dac7801c85cad26052c
child 179849 edbeca75b298e91a9d72197c19a4f8d8e51d59b3
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersechou
bugs993288
milestone31.0a1
Bug 993288 - Separate BTHF_CALL_STATE_INCOMING and BTHF_CALL_STATE_WAITING for CLCC response only, for other cases, use BTHF_CALL_STATE_INCOMING for both states. r=echou
dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp
--- a/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp
+++ b/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp
@@ -959,16 +959,21 @@ BluetoothHfpManager::SendCLCC(Call& aCal
 
   bthf_call_state_t callState = ConvertToBthfCallState(aCall.mState);
 
   if (mPhoneType == PhoneType::CDMA && aIndex == 1 && aCall.IsActive()) {
     callState = (mCdmaSecondCall.IsActive()) ? BTHF_CALL_STATE_HELD :
                                                BTHF_CALL_STATE_ACTIVE;
   }
 
+  if (callState == BTHF_CALL_STATE_INCOMING &&
+      FindFirstCall(nsITelephonyProvider::CALL_STATE_CONNECTED)) {
+    callState = BTHF_CALL_STATE_WAITING;
+  }
+
   bt_status_t status = sBluetoothHfpInterface->clcc_response(
                           aIndex,
                           aCall.mDirection,
                           callState,
                           BTHF_CALL_TYPE_VOICE,
                           BTHF_CALL_MPTY_TYPE_SINGLE,
                           NS_ConvertUTF16toUTF8(aCall.mNumber).get(),
                           aCall.mType);
@@ -1062,19 +1067,17 @@ BluetoothHfpManager::GetNumberOfCalls(ui
 
 bthf_call_state_t
 BluetoothHfpManager::ConvertToBthfCallState(int aCallState)
 {
   bthf_call_state_t state;
 
   // Refer to AOSP BluetoothPhoneService.convertCallState
   if (aCallState == nsITelephonyProvider::CALL_STATE_INCOMING) {
-    state = (FindFirstCall(nsITelephonyProvider::CALL_STATE_CONNECTED)) ?
-              BTHF_CALL_STATE_WAITING :
-              BTHF_CALL_STATE_INCOMING;
+    state = BTHF_CALL_STATE_INCOMING;
   } else if (aCallState == nsITelephonyProvider::CALL_STATE_DIALING) {
     state = BTHF_CALL_STATE_DIALING;
   } else if (aCallState == nsITelephonyProvider::CALL_STATE_ALERTING) {
     state = BTHF_CALL_STATE_ALERTING;
   } else if (aCallState == nsITelephonyProvider::CALL_STATE_CONNECTED) {
     state = BTHF_CALL_STATE_ACTIVE;
   } else if (aCallState == nsITelephonyProvider::CALL_STATE_HELD) {
     state = BTHF_CALL_STATE_HELD;