Bug 990467 - Part 2: Add pending outgoing call. r=hsinyi

This commit is contained in:
Szu-Yu Chen [:aknow] 2014-04-04 08:18:17 -04:00
parent 38ab26fca5
commit 52e9cd7e49
2 changed files with 39 additions and 0 deletions

View File

@ -76,6 +76,9 @@ const MMI_MAX_LENGTH_SHORT_CODE = 2;
const MMI_END_OF_USSD = "#";
// Should match the value we set in dom/telephony/TelephonyCommon.h
const OUTGOING_PLACEHOLDER_CALL_INDEX = 0xffffffff;
let RILQUIRKS_CALLSTATE_EXTRA_UINT32;
// This may change at runtime since in RIL v6 and later, we get the version
// number via the UNSOLICITED_RIL_CONNECTED parcel.
@ -3701,11 +3704,17 @@ RilObject.prototype = {
_processCalls: function(newCalls) {
let conferenceChanged = false;
let clearConferenceRequest = false;
let pendingOutgoingCall = null;
// Go through the calls we currently have on file and see if any of them
// changed state. Remove them from the newCalls map as we deal with them
// so that only new calls remain in the map after we're done.
for each (let currentCall in this.currentCalls) {
if (currentCall.callIndex == OUTGOING_PLACEHOLDER_CALL_INDEX) {
pendingOutgoingCall = currentCall;
continue;
}
let newCall;
if (newCalls) {
newCall = newCalls[currentCall.callIndex];
@ -3820,6 +3829,17 @@ RilObject.prototype = {
}
}
if (pendingOutgoingCall) {
// We don't get a successful call for pendingOutgoingCall.
if (!newCalls || Object.keys(newCalls).length === 0) {
this.context.debug("Disconnect pending outgoing call");
pendingOutgoingCall.failCause = GECKO_CALL_ERROR_UNSPECIFIED;
this._handleDisconnectedCall(pendingOutgoingCall);
}
delete this.currentCalls[OUTGOING_PLACEHOLDER_CALL_INDEX];
}
// Go through any remaining calls that are new to us.
for each (let newCall in newCalls) {
if (newCall.isVoice) {
@ -5265,6 +5285,14 @@ RilObject.prototype[REQUEST_DIAL] = function REQUEST_DIAL(length, options) {
options.success = (options.rilRequestError === 0);
if (options.success) {
this.sendChromeMessage(options);
// Create a pending outgoing call.
this.context.debug("Create a pending outgoing call.");
this._addNewVoiceCall({
number: options.number,
state: CALL_STATE_DIALING,
callIndex: OUTGOING_PLACEHOLDER_CALL_INDEX
});
} else {
this.getFailCauseCode((function(options, failCause) {
options.errorMsg = failCause;

View File

@ -38,6 +38,9 @@ const CDMA_SECOND_CALL_INDEX = 2;
const DIAL_ERROR_INVALID_STATE_ERROR = "InvalidStateError";
const DIAL_ERROR_OTHER_CONNECTION_IN_USE = "OtherConnectionInUse";
// Should match the value we set in dom/telephony/TelephonyCommon.h
const OUTGOING_PLACEHOLDER_CALL_INDEX = 0xffffffff;
let DEBUG;
function debug(s) {
dump("TelephonyProvider: " + s + "\n");
@ -821,6 +824,14 @@ TelephonyProvider.prototype = {
aCall.isSwitchable : true;
call.isMergeable = aCall.isMergeable != null ?
aCall.isMergeable : true;
// Get the actual call for pending outgoing call. Remove the original one.
if (this._currentCalls[aClientId][OUTGOING_PLACEHOLDER_CALL_INDEX] &&
call.callIndex != OUTGOING_PLACEHOLDER_CALL_INDEX &&
call.isOutgoing) {
delete this._currentCalls[aClientId][OUTGOING_PLACEHOLDER_CALL_INDEX];
}
this._currentCalls[aClientId][aCall.callIndex] = call;
}