Bug 993255 - Part 2: Hangup pending outgoing call. r=hsinyi

This commit is contained in:
Szu-Yu Chen [:aknow] 2014-04-10 02:06:00 +02:00
Родитель 837836430b
Коммит ed653fdc6b
1 изменённых файлов: 34 добавлений и 16 удалений

Просмотреть файл

@ -1539,20 +1539,30 @@ RilObject.prototype = {
return;
}
let Buf = this.context.Buf;
switch (call.state) {
case CALL_STATE_ACTIVE:
case CALL_STATE_DIALING:
case CALL_STATE_ALERTING:
Buf.newParcel(REQUEST_HANGUP);
Buf.writeInt32(1);
Buf.writeInt32(options.callIndex);
Buf.sendParcel();
break;
case CALL_STATE_HOLDING:
Buf.simpleRequest(REQUEST_HANGUP_WAITING_OR_BACKGROUND);
break;
let callIndex = call.callIndex;
if (callIndex === OUTGOING_PLACEHOLDER_CALL_INDEX) {
this._removeVoiceCall(call, GECKO_CALL_ERROR_NORMAL_CALL_CLEARING);
return;
}
if (call.state === CALL_STATE_HOLDING) {
this.sendHangUpBackgroundRequest(callIndex);
} else {
this.sendHangUpRequest(callIndex);
}
},
sendHangUpRequest: function(callIndex) {
let Buf = this.context.Buf;
Buf.newParcel(REQUEST_HANGUP);
Buf.writeInt32(1);
Buf.writeInt32(callIndex);
Buf.sendParcel();
},
sendHangUpBackgroundRequest: function(callIndex) {
let Buf = this.context.Buf;
Buf.simpleRequest(REQUEST_HANGUP_WAITING_OR_BACKGROUND);
},
/**
@ -3838,7 +3848,7 @@ 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");
if (DEBUG) this.context.debug("No result for pending outgoing call.");
pendingOutgoingCall.failCause = GECKO_CALL_ERROR_UNSPECIFIED;
this._handleDisconnectedCall(pendingOutgoingCall);
}
@ -3852,7 +3862,15 @@ RilObject.prototype = {
if (newCall.isMpty) {
conferenceChanged = true;
}
this._addNewVoiceCall(newCall);
if (!pendingOutgoingCall &&
(newCall.state === CALL_STATE_DIALING ||
newCall.state === CALL_STATE_ALERTING)) {
// Receive a new outgoing call which is already hung up by user.
if (DEBUG) this.context.debug("Hang up pending outgoing call");
this.sendHangUpRequest(newCall.callIndex);
} else {
this._addNewVoiceCall(newCall);
}
}
}
@ -5316,7 +5334,7 @@ RilObject.prototype[REQUEST_DIAL] = function REQUEST_DIAL(length, options) {
this.sendChromeMessage(options);
// Create a pending outgoing call.
this.context.debug("Create a pending outgoing call.");
if (DEBUG) this.context.debug("Create a pending outgoing call.");
this._addNewVoiceCall({
number: options.number,
state: CALL_STATE_DIALING,