From a953994a2b8ef6adaf89555b0d588de855f8ae8b Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Wed, 6 May 2015 17:02:38 +0200 Subject: [PATCH] Backed out changeset a78ad976faf3 (bug 1147736) --- dom/telephony/Telephony.cpp | 6 +----- dom/telephony/TelephonyCall.cpp | 24 +++++++++--------------- dom/telephony/gonk/TelephonyService.js | 14 ++++++++++++-- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/dom/telephony/Telephony.cpp b/dom/telephony/Telephony.cpp index 018e2e206657..62b7822f88a7 100644 --- a/dom/telephony/Telephony.cpp +++ b/dom/telephony/Telephony.cpp @@ -377,14 +377,10 @@ Telephony::HandleCallInfo(nsITelephonyCallInfo* aInfo) nsRefPtr id = call->Id(); id->UpdateNumber(number); - nsAutoString disconnectedReason; - aInfo->GetDisconnectedReason(disconnectedReason); - // State changed. if (call->CallState() != callState) { if (callState == nsITelephonyService::CALL_STATE_DISCONNECTED) { - call->UpdateDisconnectedReason(disconnectedReason); - call->ChangeState(nsITelephonyService::CALL_STATE_DISCONNECTED); + call->ChangeStateInternal(callState, true); return NS_OK; } diff --git a/dom/telephony/TelephonyCall.cpp b/dom/telephony/TelephonyCall.cpp index b52c3572335c..97cabb7fb8c4 100644 --- a/dom/telephony/TelephonyCall.cpp +++ b/dom/telephony/TelephonyCall.cpp @@ -134,6 +134,7 @@ TelephonyCall::ChangeStateInternal(uint16_t aCallState, bool aFireEvents) } else { mTelephony->RemoveCall(this); } + UpdateDisconnectedReason(NS_LITERAL_STRING("NormalCallClearingError")); } else if (!mLive) { mLive = true; if (mGroup) { @@ -210,23 +211,16 @@ 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()) { - 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); + 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); } } diff --git a/dom/telephony/gonk/TelephonyService.js b/dom/telephony/gonk/TelephonyService.js index 04d8c2e16dff..1112051fa87e 100644 --- a/dom/telephony/gonk/TelephonyService.js +++ b/dom/telephony/gonk/TelephonyService.js @@ -1450,6 +1450,10 @@ 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) { @@ -1473,7 +1477,7 @@ TelephonyService.prototype = { disconnectedCalls.forEach(call => { call.state = nsITelephonyService.CALL_STATE_DISCONNECTED; - call.disconnectedReason = aFailCause; + call.failCause = aFailCause; if (call.parentId) { let parentCall = this._currentCalls[aClientId][call.parentId]; @@ -1482,7 +1486,13 @@ TelephonyService.prototype = { this._notifyCallEnded(call); - callsForStateChanged.push(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]); + } delete this._currentCalls[aClientId][call.callIndex]; });