author | Ben Hsu <bhsu@mozilla.com> |
Sun, 11 Jan 2015 03:25:00 -0500 | |
changeset 223635 | a232d580f5e9c7dad08e1bf1441c5fe263def7c6 |
parent 223634 | 90515a836a64ae184ca0d63d804a7275ba3a0a2b |
child 223636 | 49140c36a7fd3aa3261cacdd10ec5f18a3a39bd6 |
push id | 28099 |
push user | kwierso@gmail.com |
push date | Wed, 14 Jan 2015 01:38:51 +0000 |
treeherder | mozilla-central@3100ceecc1bb [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | aknow |
bugs | 1095362 |
milestone | 38.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/telephony/gonk/TelephonyService.js +++ b/dom/telephony/gonk/TelephonyService.js @@ -622,17 +622,19 @@ TelephonyService.prototype = { this._cachedDialRequest = { clientId: aClientId, options: aOptions, callback: aCallback }; if (activeCall.isConference) { - this.holdConference(aClientId); + this.holdConference(aClientId, + { notifySuccess: function () {}, + notifyError: function (errorMsg) {} }); } else { this.holdCall(aClientId, activeCall.callIndex, { notifySuccess: function () {}, notifyError: function (errorMsg) {} }); } } }, @@ -1014,119 +1016,110 @@ TelephonyService.prototype = { aCallback.notifyError(RIL.GECKO_ERROR_GENERIC_FAILURE); return; } this._sendToRilWorker(aClientId, "resumeCall", { callIndex: aCallIndex }, this._defaultCallbackHandler.bind(this, aCallback)); }, - conferenceCall: function(aClientId) { + conferenceCall: function(aClientId, aCallback) { let indexes = Object.keys(this._currentCalls[aClientId]); if (indexes.length < 2) { - // TODO: Bug 975949 - [B2G] Telephony should throw exceptions when some - // operations aren't allowed instead of simply ignoring them. + aCallback.notifyError(RIL.GECKO_ERROR_GENERIC_FAILURE); return; } for (let i = 0; i < indexes.length; ++i) { let call = this._currentCalls[aClientId][indexes[i]]; if (!call.isMergeable) { + aCallback.notifyError(RIL.GECKO_ERROR_GENERIC_FAILURE); return; } } - function onCdmaConferenceCallSuccess() { - let indexes = Object.keys(this._currentCalls[aClientId]); - if (indexes.length < 2) { - return; - } - - for (let i = 0; i < indexes.length; ++i) { - let call = this._currentCalls[aClientId][indexes[i]]; - call.state = RIL.CALL_STATE_ACTIVE; - call.isConference = true; - this.notifyCallStateChanged(aClientId, call); - } - this.notifyConferenceCallStateChanged(RIL.CALL_STATE_ACTIVE); - } - this._sendToRilWorker(aClientId, "conferenceCall", null, response => { if (!response.success) { + aCallback.notifyError(RIL.GECKO_ERROR_GENERIC_FAILURE); this._notifyAllListeners("notifyConferenceError", [response.errorName, response.errorMsg]); return; } if (response.isCdma) { - onCdmaConferenceCallSuccess.call(this); + let indexes = Object.keys(this._currentCalls[aClientId]); + if (indexes.length < 2) { + aCallback.notifyError(RIL.GECKO_ERROR_GENERIC_FAILURE); + return; + } + + for (let i = 0; i < indexes.length; ++i) { + let call = this._currentCalls[aClientId][indexes[i]]; + call.state = RIL.CALL_STATE_ACTIVE; + call.isConference = true; + this.notifyCallStateChanged(aClientId, call); + } + this.notifyConferenceCallStateChanged(RIL.CALL_STATE_ACTIVE); } + + aCallback.notifySuccess(); }); }, - separateCall: function(aClientId, aCallIndex) { + separateCall: function(aClientId, aCallIndex, aCallback) { let call = this._currentCalls[aClientId][aCallIndex]; if (!call || !call.isConference) { - // TODO: Bug 975949 - [B2G] Telephony should throw exceptions when some - // operations aren't allowed instead of simply ignoring them. + aCallback.notifyError(RIL.GECKO_ERROR_GENERIC_FAILURE); return; } let parentId = call.parentId; if (parentId) { this.separateCall(aClientId, parentId); return; } - function onCdmaSeparateCallSuccess() { - // See 3gpp2, S.R0006-522-A v1.0. Table 4, XID 6S. - let call = this._currentCalls[aClientId][aCallIndex]; - if (!call || !call.isConference) { - return; - } - - let childId = call.childId; - if (!childId) { - return; - } - - let childCall = this._currentCalls[aClientId][childId]; - this.notifyCallDisconnected(aClientId, childCall); - } - this._sendToRilWorker(aClientId, "separateCall", { callIndex: aCallIndex }, response => { if (!response.success) { + aCallback.notifyError(RIL.GECKO_ERROR_GENERIC_FAILURE); this._notifyAllListeners("notifyConferenceError", [response.errorName, response.errorMsg]); return; } if (response.isCdma) { - onCdmaSeparateCallSuccess.call(this); + // See 3gpp2, S.R0006-522-A v1.0. Table 4, XID 6S. + let call = this._currentCalls[aClientId][aCallIndex]; + if (!call || !call.isConference || !call.childId) { + aCallback.notifyError(RIL.GECKO_ERROR_GENERIC_FAILURE); + return; + } + + let childCall = this._currentCalls[aClientId][call.childId]; + this.notifyCallDisconnected(aClientId, childCall); } + + aCallback.notifySuccess(); }); }, hangUpConference: function(aClientId, aCallback) { - this._sendToRilWorker(aClientId, "hangUpConference", null, response => { - if (!response.success) { - aCallback.notifyError(response.errorMsg); - } else { - aCallback.notifySuccess(); - } - }); + this._sendToRilWorker(aClientId, "hangUpConference", null, + this._defaultCallbackHandler.bind(this, aCallback)); }, - holdConference: function(aClientId) { - this._sendToRilWorker(aClientId, "holdConference"); + holdConference: function(aClientId, aCallback) { + this._sendToRilWorker(aClientId, "holdConference", null, + this._defaultCallbackHandler.bind(this, aCallback)); }, - resumeConference: function(aClientId) { - this._sendToRilWorker(aClientId, "resumeConference"); + resumeConference: function(aClientId, aCallback) { + this._sendToRilWorker(aClientId, "resumeConference", null, + this._defaultCallbackHandler.bind(this, aCallback)); }, sendUSSD: function(aClientId, aUssd, aCallback) { this._sendToRilWorker(aClientId, "sendUSSD", { ussd: aUssd, checkSession: true }, response => { if (!response.success) { aCallback.notifyError(response.errorMsg);