mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 17:25:36 +00:00
Bug 1077075 - Part 5: Internal architecture (ril_worker.js). r=aknow
--HG-- extra : histedit_source : cbf3e2c16ccb8c11bf85091e4eda57398cdaf0b0
This commit is contained in:
parent
ebdb0ba6a1
commit
2a7565cc63
@ -1687,7 +1687,7 @@ RilObject.prototype = {
|
||||
*/
|
||||
hangUpAll: function() {
|
||||
for (let callIndex in this.currentCalls) {
|
||||
this.hangUp({callIndex: callIndex});
|
||||
this.hangUpCall({callIndex: callIndex});
|
||||
}
|
||||
},
|
||||
|
||||
@ -1697,9 +1697,14 @@ RilObject.prototype = {
|
||||
* @param callIndex
|
||||
* Call index (1-based) as reported by REQUEST_GET_CURRENT_CALLS.
|
||||
*/
|
||||
hangUp: function(options) {
|
||||
hangUpCall: function(options) {
|
||||
let call = this.currentCalls[options.callIndex];
|
||||
if (!call) {
|
||||
// |hangUpCall()| is used to remove a call from the current call list,
|
||||
// so we consider it as an successful case when hanging up a call that
|
||||
// doesn't exist in the current call list.
|
||||
options.success = true;
|
||||
this.sendChromeMessage(options);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1781,6 +1786,9 @@ RilObject.prototype = {
|
||||
answerCall: function(options) {
|
||||
let call = this.currentCalls[options.callIndex];
|
||||
if (!call) {
|
||||
options.success = false;
|
||||
options.errorMsg = GECKO_ERROR_GENERIC_FAILURE;
|
||||
this.sendChromeMessage(options);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1791,13 +1799,19 @@ RilObject.prototype = {
|
||||
switch (call.state) {
|
||||
case CALL_STATE_INCOMING:
|
||||
this.telephonyRequestQueue.push(REQUEST_ANSWER, () => {
|
||||
this.context.Buf.simpleRequest(REQUEST_ANSWER);
|
||||
this.context.Buf.simpleRequest(REQUEST_ANSWER, options);
|
||||
});
|
||||
break;
|
||||
case CALL_STATE_WAITING:
|
||||
// Answer the waiting (second) call, and hold the first call.
|
||||
this.switchActiveCall(options);
|
||||
break;
|
||||
default:
|
||||
if (DEBUG) this.context.debug("AnswerCall: Invalid call state");
|
||||
|
||||
options.success = false;
|
||||
options.errorMsg = GECKO_ERROR_GENERIC_FAILURE;
|
||||
this.sendChromeMessage(options);
|
||||
}
|
||||
},
|
||||
|
||||
@ -1808,12 +1822,13 @@ RilObject.prototype = {
|
||||
* Call index of the call to reject.
|
||||
*/
|
||||
rejectCall: function(options) {
|
||||
// Check for races. Since we dispatched the incoming/waiting call
|
||||
// notification the incoming/waiting call may have changed. The main
|
||||
// thread thinks that it is rejecting the call with the given index,
|
||||
// so only reject if that is still incoming/waiting.
|
||||
let call = this.currentCalls[options.callIndex];
|
||||
if (!call) {
|
||||
// |hangUpCall()| is used to remove an imcoming call from the current
|
||||
// call list, so we consider it as an successful case when rejecting
|
||||
// a call that doesn't exist in the current call list.
|
||||
options.success = true;
|
||||
this.sendChromeMessage(options);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1825,6 +1840,10 @@ RilObject.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for races. Since we dispatched the incoming/waiting call
|
||||
// notification the incoming/waiting call may have changed. The main
|
||||
// thread thinks that it is rejecting the call with the given index,
|
||||
// so only reject if that is still incoming/waiting.
|
||||
switch (call.state) {
|
||||
case CALL_STATE_INCOMING:
|
||||
this.udub(options);
|
||||
@ -1833,6 +1852,12 @@ RilObject.prototype = {
|
||||
// Reject the waiting (second) call, and remain the first call.
|
||||
this.hangUpBackground(options);
|
||||
break;
|
||||
default:
|
||||
if (DEBUG) this.context.debug("RejectCall: Invalid call state");
|
||||
|
||||
options.success = false;
|
||||
options.errorMsg = GECKO_ERROR_GENERIC_FAILURE;
|
||||
this.sendChromeMessage(options);
|
||||
}
|
||||
},
|
||||
|
||||
@ -1921,7 +1946,7 @@ RilObject.prototype = {
|
||||
}
|
||||
|
||||
options.callIndex = 1;
|
||||
this.hangUp(options);
|
||||
this.hangUpCall(options);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5487,6 +5512,10 @@ RilObject.prototype[REQUEST_GET_IMSI] = function REQUEST_GET_IMSI(length, option
|
||||
this.sendChromeMessage(options);
|
||||
};
|
||||
RilObject.prototype[REQUEST_HANGUP] = function REQUEST_HANGUP(length, options) {
|
||||
if (options.rilMessageType == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
options.success = (options.rilRequestError === 0);
|
||||
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
|
||||
this.sendChromeMessage(options);
|
||||
@ -5514,6 +5543,11 @@ RilObject.prototype[REQUEST_CONFERENCE] = function REQUEST_CONFERENCE(length, op
|
||||
this.sendChromeMessage(options);
|
||||
};
|
||||
RilObject.prototype[REQUEST_UDUB] = function REQUEST_UDUB(length, options) {
|
||||
options.success = (options.rilRequestError === 0);
|
||||
if (!options.success) {
|
||||
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
|
||||
}
|
||||
this.sendChromeMessage(options);
|
||||
};
|
||||
RilObject.prototype[REQUEST_LAST_CALL_FAIL_CAUSE] = function REQUEST_LAST_CALL_FAIL_CAUSE(length, options) {
|
||||
let Buf = this.context.Buf;
|
||||
@ -5968,6 +6002,11 @@ RilObject.prototype[REQUEST_GET_IMEISV] = function REQUEST_GET_IMEISV(length, op
|
||||
this.IMEISV = this.context.Buf.readString();
|
||||
};
|
||||
RilObject.prototype[REQUEST_ANSWER] = function REQUEST_ANSWER(length, options) {
|
||||
options.success = (options.rilRequestError === 0);
|
||||
if (!options.success) {
|
||||
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
|
||||
}
|
||||
this.sendChromeMessage(options);
|
||||
};
|
||||
RilObject.prototype[REQUEST_DEACTIVATE_DATA_CALL] = function REQUEST_DEACTIVATE_DATA_CALL(length, options) {
|
||||
if (options.rilRequestError) {
|
||||
|
Loading…
Reference in New Issue
Block a user