зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1095362 - Part 4: Internal architecture changes (TelephonyService.js). r=aknow
This commit is contained in:
Родитель
5acd685c74
Коммит
f5887552f0
|
@ -627,7 +627,9 @@ TelephonyService.prototype = {
|
|||
};
|
||||
|
||||
if (activeCall.isConference) {
|
||||
this.holdConference(aClientId);
|
||||
this.holdConference(aClientId,
|
||||
{ notifySuccess: function () {},
|
||||
notifyError: function (errorMsg) {} });
|
||||
} else {
|
||||
this.holdCall(aClientId, activeCall.callIndex,
|
||||
{ notifySuccess: function () {},
|
||||
|
@ -1019,54 +1021,53 @@ TelephonyService.prototype = {
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -1076,52 +1077,44 @@ TelephonyService.prototype = {
|
|||
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) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче