Bug 812368 - B2G RIL: dispatch 'telephony-new-call' system message directly after receiving UNSOLICITED_CALL_RING from rild. r=hsinyi

This commit is contained in:
Philipp von Weitershausen 2012-11-27 20:28:43 -05:00
parent f096a5742f
commit 609c647a8a
2 changed files with 25 additions and 13 deletions

View File

@ -473,6 +473,9 @@ RadioInterfaceLayer.prototype = {
let message = event.data;
debug("Received message from worker: " + JSON.stringify(message));
switch (message.rilMessageType) {
case "callRing":
this.handleCallRing();
break;
case "callStateChange":
// This one will handle its own notifications.
this.handleCallStateChange(message.call);
@ -1137,6 +1140,16 @@ RadioInterfaceLayer.prototype = {
}
},
/**
* Handle an incoming call.
*
* Not much is known about this call at this point, but it's enough
* to start bringing up the Phone app already.
*/
handleCallRing: function handleCallRing() {
gSystemMessenger.broadcastMessage("telephony-new-call");
},
/**
* Handle call state changes by updating our current state and the audio
* system.
@ -1145,10 +1158,8 @@ RadioInterfaceLayer.prototype = {
debug("handleCallStateChange: " + JSON.stringify(call));
call.state = convertRILCallState(call.state);
if (call.state == nsIRadioInterfaceLayer.CALL_STATE_INCOMING ||
call.state == nsIRadioInterfaceLayer.CALL_STATE_DIALING) {
gSystemMessenger.broadcastMessage("telephony-new-call", {number: call.number,
state: call.state});
if (call.state == nsIRadioInterfaceLayer.CALL_STATE_DIALING) {
gSystemMessenger.broadcastMessage("telephony-new-call");
}
if (call.isActive) {

View File

@ -5169,18 +5169,19 @@ RIL[UNSOLICITED_STK_CALL_SETUP] = null;
RIL[UNSOLICITED_SIM_SMS_STORAGE_FULL] = null;
RIL[UNSOLICITED_SIM_REFRESH] = null;
RIL[UNSOLICITED_CALL_RING] = function UNSOLICITED_CALL_RING() {
let info;
let info = {rilMessageType: "callRing"};
let isCDMA = false; //XXX TODO hard-code this for now
if (isCDMA) {
info = {
isPresent: Buf.readUint32(),
signalType: Buf.readUint32(),
alertPitch: Buf.readUint32(),
signal: Buf.readUint32()
};
info.isPresent = Buf.readUint32();
info.signalType = Buf.readUint32();
info.alertPitch = Buf.readUint32();
info.signal = Buf.readUint32();
}
// For now we don't need to do anything here because we'll also get a
// call state changed notification.
// At this point we don't know much other than the fact there's an incoming
// call, but that's enough to bring up the Phone app already. We'll know
// details once we get a call state changed notification and can then
// dispatch DOM events etc.
this.sendDOMMessage(info);
};
RIL[UNSOLICITED_RESPONSE_SIM_STATUS_CHANGED] = function UNSOLICITED_RESPONSE_SIM_STATUS_CHANGED() {
this.getICCStatus();