Bug 1102671 - Set hangUpLocal correctly. r=hsinyi

This commit is contained in:
Szu-Yu Chen [:aknow] 2014-12-14 19:48:13 +08:00
Родитель 8051af2598
Коммит b300b7156f
1 изменённых файлов: 28 добавлений и 0 удалений

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

@ -1726,6 +1726,12 @@ RilObject.prototype = {
},
hangUpForeground: function(options) {
for each (let currentCall in this.currentCalls) {
if (currentCall.state == CALL_STATE_ACTIVE) {
currentCall.hangUpLocal = true;
}
}
this.telephonyRequestQueue.push(REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND, () => {
this.context.Buf.simpleRequest(REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND,
options);
@ -1733,6 +1739,28 @@ RilObject.prototype = {
},
hangUpBackground: function(options) {
let waitingCalls = [];
let heldCalls = [];
for each (let currentCall in this.currentCalls) {
switch (currentCall.state) {
case CALL_STATE_WAITING:
waitingCalls.push(currentCall);
break;
case CALL_STATE_HOLDING:
heldCalls.push(currentCall);
break;
}
}
// When both a held and a waiting call exist, the request shall apply to
// the waiting call.
if (waitingCalls.length) {
waitingCalls.forEach(call => call.hangUpLocal = true);
} else {
heldCalls.forEach(call => call.hangUpLocal = true);
}
this.telephonyRequestQueue.push(REQUEST_HANGUP_WAITING_OR_BACKGROUND, () => {
this.context.Buf.simpleRequest(REQUEST_HANGUP_WAITING_OR_BACKGROUND,
options);