Bug 1147736 - Part 2: Bypass NotifyError. r=aknow

This commit is contained in:
Ben Hsu 2015-04-27 23:28:00 -04:00
parent f2a6216f1f
commit 8265eee4b9
3 changed files with 22 additions and 22 deletions

View File

@ -377,10 +377,14 @@ Telephony::HandleCallInfo(nsITelephonyCallInfo* aInfo)
nsRefPtr<TelephonyCallId> id = call->Id();
id->UpdateNumber(number);
nsAutoString disconnectedReason;
aInfo->GetDisconnectedReason(disconnectedReason);
// State changed.
if (call->CallState() != callState) {
if (callState == nsITelephonyService::CALL_STATE_DISCONNECTED) {
call->ChangeStateInternal(callState, true);
call->UpdateDisconnectedReason(disconnectedReason);
call->ChangeState(nsITelephonyService::CALL_STATE_DISCONNECTED);
return NS_OK;
}

View File

@ -134,7 +134,6 @@ TelephonyCall::ChangeStateInternal(uint16_t aCallState, bool aFireEvents)
} else {
mTelephony->RemoveCall(this);
}
UpdateDisconnectedReason(NS_LITERAL_STRING("NormalCallClearingError"));
} else if (!mLive) {
mLive = true;
if (mGroup) {
@ -211,16 +210,23 @@ TelephonyCall::NotifyError(const nsAString& aError)
void
TelephonyCall::UpdateDisconnectedReason(const nsAString& aDisconnectedReason)
{
NS_ASSERTION(Substring(aDisconnectedReason, aDisconnectedReason.Length() - 5).EqualsLiteral("Error"),
NS_ASSERTION(Substring(aDisconnectedReason,
aDisconnectedReason.Length() - 5).EqualsLiteral("Error"),
"Disconnected reason should end with 'Error'");
if (mDisconnectedReason.IsNull()) {
// There is no 'Error' suffix in the corresponding enum. We should skip
// that part for comparison.
CONVERT_STRING_TO_NULLABLE_ENUM(
Substring(aDisconnectedReason, 0, aDisconnectedReason.Length() - 5),
TelephonyCallDisconnectedReason,
mDisconnectedReason);
if (!mDisconnectedReason.IsNull()) {
return;
}
// There is no 'Error' suffix in the corresponding enum. We should skip
// that part for comparison.
CONVERT_STRING_TO_NULLABLE_ENUM(
Substring(aDisconnectedReason, 0, aDisconnectedReason.Length() - 5),
TelephonyCallDisconnectedReason,
mDisconnectedReason);
if (!aDisconnectedReason.EqualsLiteral("NormalCallClearingError")) {
NotifyError(aDisconnectedReason);
}
}

View File

@ -1450,10 +1450,6 @@ TelephonyService.prototype = {
* calls being disconnected as well.
*
* @return Array a list of calls we need to fire callStateChange
*
* TODO: The list currently doesn't contain calls that we fire notifyError
* for them. However, after Bug 1147736, notifyError is replaced by
* callStateChanged and those calls should be included in the list.
*/
_disconnectCalls: function(aClientId, aCalls,
aFailCause = RIL.GECKO_CALL_ERROR_NORMAL_CALL_CLEARING) {
@ -1477,7 +1473,7 @@ TelephonyService.prototype = {
disconnectedCalls.forEach(call => {
call.state = nsITelephonyService.CALL_STATE_DISCONNECTED;
call.failCause = aFailCause;
call.disconnectedReason = aFailCause;
if (call.parentId) {
let parentCall = this._currentCalls[aClientId][call.parentId];
@ -1486,13 +1482,7 @@ TelephonyService.prototype = {
this._notifyCallEnded(call);
if (call.hangUpLocal || !call.failCause ||
call.failCause === RIL.GECKO_CALL_ERROR_NORMAL_CALL_CLEARING) {
callsForStateChanged.push(call);
} else {
this._notifyAllListeners("notifyError",
[aClientId, call.callIndex, call.failCause]);
}
callsForStateChanged.push(call);
delete this._currentCalls[aClientId][call.callIndex];
});