Skip to content

Commit

Permalink
Backed out changeset a78ad976faf3 (bug 1147736)
Browse files Browse the repository at this point in the history
  • Loading branch information
BavarianTomcat committed May 6, 2015
1 parent 9344729 commit a953994
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
6 changes: 1 addition & 5 deletions dom/telephony/Telephony.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,14 +377,10 @@ 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->UpdateDisconnectedReason(disconnectedReason);
call->ChangeState(nsITelephonyService::CALL_STATE_DISCONNECTED);
call->ChangeStateInternal(callState, true);
return NS_OK;
}

Expand Down
24 changes: 9 additions & 15 deletions dom/telephony/TelephonyCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
}

Expand Down
14 changes: 12 additions & 2 deletions dom/telephony/gonk/TelephonyService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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];
Expand All @@ -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];
});
Expand Down

0 comments on commit a953994

Please sign in to comment.