Backed out changeset 736965f66934

This commit is contained in:
Eric Chou 2013-06-02 22:42:43 +08:00
parent 6d70a08a5d
commit 82aab3bfd5

View File

@ -1282,11 +1282,7 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
switch (aCallState) { switch (aCallState) {
case nsITelephonyProvider::CALL_STATE_HELD: case nsITelephonyProvider::CALL_STATE_HELD:
if (!FindFirstCall(nsIRadioInterfaceLayer::CALL_STATE_CONNECTED)) { sCINDItems[CINDType::CALLHELD].value = CallHeldState::ONHOLD_ACTIVE;
sCINDItems[CINDType::CALLHELD].value = CallHeldState::ONHOLD_NOACTIVE;
} else {
sCINDItems[CINDType::CALLHELD].value = CallHeldState::ONHOLD_ACTIVE;
}
SendCommand("+CIEV: ", CINDType::CALLHELD); SendCommand("+CIEV: ", CINDType::CALLHELD);
break; break;
case nsITelephonyProvider::CALL_STATE_INCOMING: case nsITelephonyProvider::CALL_STATE_INCOMING:
@ -1344,27 +1340,25 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
UpdateCIND(CINDType::CALL, CallState::IN_PROGRESS, aSend); UpdateCIND(CINDType::CALL, CallState::IN_PROGRESS, aSend);
UpdateCIND(CINDType::CALLSETUP, CallSetupState::NO_CALLSETUP, aSend); UpdateCIND(CINDType::CALLSETUP, CallSetupState::NO_CALLSETUP, aSend);
break; break;
case nsITelephonyProvider::CALL_STATE_HELD:
// Besides checking if there is still held calls, another thing we
// need to consider is the state change when receiving AT+CHLD=2.
// Assume that there is one active call(c1) and one call on hold(c2).
// We got AT+CHLD=2, which swaps active/held position. The first
// action would be c2 -> ACTIVE, then c1 -> HELD. When we get the
// CallStateChanged event of c2 becoming ACTIVE, we enter here.
// However we can't send callheld=0 at this time because we should
// see c2 -> ACTIVE + c1 -> HELD as one operation. That's the reason
// why I added the GetNumberOfCalls() condition check.
if (!FindFirstCall(nsITelephonyProvider::CALL_STATE_HELD) &&
GetNumberOfCalls(
nsITelephonyProvider::CALL_STATE_CONNECTED) == 1) {
UpdateCIND(CINDType::CALLHELD, CallHeldState::NO_CALLHELD, aSend);
}
break;
default: default:
NS_WARNING("Not handling state changed"); NS_WARNING("Not handling state changed");
} }
// = Handle callheld separately =
// Besides checking if there is still held calls, another thing we
// need to consider is the state change when receiving AT+CHLD=2.
// Assume that there is one active call(c1) and one call on hold(c2).
// We got AT+CHLD=2, which swaps active/held position. The first
// action would be c2 -> ACTIVE, then c1 -> HELD. When we get the
// CallStateChanged event of c2 becoming ACTIVE, we enter here.
// However we can't send callheld=0 at this time because we should
// see c2 -> ACTIVE + c1 -> HELD as one operation. That's the reason
// why I added the GetNumberOfCalls() condition check.
if (GetNumberOfCalls(nsIRadioInterfaceLayer::CALL_STATE_CONNECTED) == 1) {
if (FindFirstCall(nsIRadioInterfaceLayer::CALL_STATE_HELD)) {
UpdateCIND(CINDType::CALLHELD, CallHeldState::ONHOLD_ACTIVE, aSend);
} else if (currentCallState == nsIRadioInterfaceLayer::CALL_STATE_HELD) {
UpdateCIND(CINDType::CALLHELD, CallHeldState::NO_CALLHELD, aSend);
}
}
break; break;
case nsITelephonyProvider::CALL_STATE_DISCONNECTED: case nsITelephonyProvider::CALL_STATE_DISCONNECTED:
switch (prevCallState) { switch (prevCallState) {
@ -1384,19 +1378,13 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
UpdateCIND(CINDType::CALL, CallState::NO_CALL, aSend); UpdateCIND(CINDType::CALL, CallState::NO_CALL, aSend);
} }
break; break;
case nsITelephonyProvider::CALL_STATE_HELD:
UpdateCIND(CINDType::CALLHELD, CallHeldState::NO_CALLHELD, aSend);
break;
default: default:
NS_WARNING("Not handling state changed"); NS_WARNING("Not handling state changed");
} }
// Handle held calls separately
if (!FindFirstCall(nsIRadioInterfaceLayer::CALL_STATE_HELD)) {
UpdateCIND(CINDType::CALLHELD, CallHeldState::NO_CALLHELD, aSend);
} else if (!FindFirstCall(nsIRadioInterfaceLayer::CALL_STATE_CONNECTED)) {
UpdateCIND(CINDType::CALLHELD, CallHeldState::ONHOLD_NOACTIVE, aSend);
} else {
UpdateCIND(CINDType::CALLHELD, CallHeldState::ONHOLD_ACTIVE, aSend);
}
// -1 is necessary because call 0 is an invalid (padding) call object. // -1 is necessary because call 0 is an invalid (padding) call object.
if (mCurrentCallArray.Length() - 1 == if (mCurrentCallArray.Length() - 1 ==
GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_DISCONNECTED)) { GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_DISCONNECTED)) {