Bug 1124550 - Part 07: Refactoring hangupConference. r=hsinyi

This commit is contained in:
Szu-Yu Chen [:aknow] 2015-02-03 12:18:20 +08:00
parent 6dbd47a3f1
commit 4bd218e345
2 changed files with 16 additions and 26 deletions

View File

@ -1958,29 +1958,6 @@ RilObject.prototype = {
});
},
hangUpConference: function(options) {
if (this._isCdma) {
// In cdma, ril only maintains one call index.
let call = this.currentCalls[1];
if (!call) {
options.success = false;
options.errorMsg = GECKO_ERROR_GENERIC_FAILURE;
this.sendChromeMessage(options);
return;
}
options.callIndex = 1;
this.hangUpCall(options);
return;
}
if (this.currentConferenceState === CALL_STATE_ACTIVE) {
this.hangUpForeground(options);
} else {
this.hangUpBackground(options);
}
},
holdConference: function(options) {
if (this._isCdma) {
// We cannot hold a conference call on CDMA.

View File

@ -159,6 +159,7 @@ function TelephonyService() {
this._isDialing = false;
this._cachedDialRequest = null;
this._currentCalls = {};
this._currentConferenceState = nsITelephonyService.CALL_STATE_UNKNOWN;
this._audioStates = {};
this._cdmaCallWaitingNumber = null;
@ -980,7 +981,18 @@ TelephonyService.prototype = {
},
hangUpConference: function(aClientId, aCallback) {
this._sendToRilWorker(aClientId, "hangUpConference", null,
// In cdma, ril only maintains one call index.
if (this._isCdmaClient(aClientId)) {
this._sendToRilWorker(aClientId, "hangUpCall",
{ callIndex: CDMA_FIRST_CALL_INDEX },
this._defaultCallbackHandler.bind(this, aCallback));
return;
}
let foreground = this._currentConferenceState == nsITelephonyService.CALL_STATE_CONNECTED;
this._sendToRilWorker(aClientId,
foreground ? "hangUpForeground" : "hangUpBackground",
null,
this._defaultCallbackHandler.bind(this, aCallback));
},
@ -1195,8 +1207,9 @@ TelephonyService.prototype = {
notifyConferenceCallStateChanged: function(aState) {
if (DEBUG) debug("handleConferenceCallStateChanged: " + aState);
aState = this._convertRILCallState(aState);
this._notifyAllListeners("conferenceCallStateChanged", [aState]);
this._currentConferenceState = this._convertRILCallState(aState);
this._notifyAllListeners("conferenceCallStateChanged",
[this._currentConferenceState]);
},
notifyUssdReceived: function(aClientId, aMessage, aSessionEnded) {