Bug 834160 - Part 7/7: Fix RILContentHelper. r=htsai,allstars.chh

This commit is contained in:
Vicamo Yang 2013-03-06 17:53:31 +08:00
parent 68d6011633
commit 8ff8099d18
2 changed files with 185 additions and 166 deletions

View File

@ -84,17 +84,6 @@ const RIL_IPC_MSG_NAMES = [
"RIL:IccExchangeAPDU"
];
const kVoiceChangedTopic = "mobile-connection-voice-changed";
const kDataChangedTopic = "mobile-connection-data-changed";
const kCardStateChangedTopic = "mobile-connection-cardstate-changed";
const kIccInfoChangedTopic = "mobile-connection-iccinfo-changed";
const kUssdReceivedTopic = "mobile-connection-ussd-received";
const kStkCommandTopic = "icc-manager-stk-command";
const kStkSessionEndTopic = "icc-manager-stk-session-end";
const kDataErrorTopic = "mobile-connection-data-error";
const kIccCardLockErrorTopic = "mobile-connection-icccardlock-error";
const kCfStateChangedTopic = "mobile-connection-cfstate-change";
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
"@mozilla.org/childprocessmessagemanager;1",
"nsISyncMessageSender");
@ -335,13 +324,19 @@ RILContentHelper.prototype = {
__proto__: DOMRequestIpcHelper.prototype,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileConnectionProvider,
Ci.nsIRILContentHelper,
Ci.nsICellBroadcastProvider,
Ci.nsIVoicemailProvider,
Ci.nsITelephonyProvider,
Ci.nsIIccProvider,
Ci.nsIObserver]),
classID: RILCONTENTHELPER_CID,
classInfo: XPCOMUtils.generateCI({classID: RILCONTENTHELPER_CID,
classDescription: "RILContentHelper",
interfaces: [Ci.nsIMobileConnectionProvider,
Ci.nsIRILContentHelper]}),
Ci.nsICellBroadcastProvider,
Ci.nsIVoicemailProvider,
Ci.nsITelephonyProvider,
Ci.nsIIccProvider]}),
// An utility function to copy objects.
updateInfo: function updateInfo(srcInfo, destInfo) {
@ -710,8 +705,11 @@ RILContentHelper.prototype = {
return request;
},
_telephonyCallbacks: null,
_voicemailCallbacks: null,
_mobileConnectionListeners: null,
_telephonyListeners: null,
_cellBroadcastListeners: null,
_voicemailListeners: null,
_iccListeners: null,
_enumerateTelephonyCallbacks: null,
voicemailStatus: null,
@ -736,85 +734,91 @@ RILContentHelper.prototype = {
return this.getVoicemailInfo().displayName;
},
registerCallback: function registerCallback(callbackType, callback) {
let callbacks = this[callbackType];
if (!callbacks) {
callbacks = this[callbackType] = [];
registerListener: function registerListener(listenerType, listener) {
let listeners = this[listenerType];
if (!listeners) {
listeners = this[listenerType] = [];
}
if (callbacks.indexOf(callback) != -1) {
throw new Error("Already registered this callback!");
if (listeners.indexOf(listener) != -1) {
throw new Error("Already registered this listener!");
}
callbacks.push(callback);
if (DEBUG) debug("Registered " + callbackType + " callback: " + callback);
listeners.push(listener);
if (DEBUG) debug("Registered " + listenerType + " listener: " + listener);
},
unregisterCallback: function unregisterCallback(callbackType, callback) {
let callbacks = this[callbackType];
if (!callbacks) {
unregisterListener: function unregisterListener(listenerType, listener) {
let listeners = this[listenerType];
if (!listeners) {
return;
}
let index = callbacks.indexOf(callback);
let index = listeners.indexOf(listener);
if (index != -1) {
callbacks.splice(index, 1);
if (DEBUG) debug("Unregistered telephony callback: " + callback);
listeners.splice(index, 1);
if (DEBUG) debug("Unregistered listener: " + listener);
}
},
registerTelephonyCallback: function registerTelephonyCallback(callback) {
this.registerCallback("_telephonyCallbacks", callback);
},
unregisterTelephonyCallback: function unregisteTelephonyCallback(callback) {
this.unregisterCallback("_telephonyCallbacks", callback);
// We also need to make sure the callback is removed from
// _enumerateTelephonyCallbacks.
let index = this._enumerateTelephonyCallbacks.indexOf(callback);
if (index != -1) {
this._enumerateTelephonyCallbacks.splice(index, 1);
if (DEBUG) debug("Unregistered enumerateTelephony callback: " + callback);
}
},
registerVoicemailCallback: function registerVoicemailCallback(callback) {
this.registerCallback("_voicemailCallbacks", callback);
},
unregisterVoicemailCallback: function unregisteVoicemailCallback(callback) {
this.unregisterCallback("_voicemailCallbacks", callback);
},
registerCellBroadcastCallback: function registerCellBroadcastCallback(callback) {
this.registerCallback("_cellBroadcastCallbacks", callback);
},
unregisterCellBroadcastCallback: function unregisterCellBroadcastCallback(callback) {
this.unregisterCallback("_cellBroadcastCallbacks", callback);
},
registerTelephonyMsg: function registerTelephonyMsg() {
debug("Registering for telephony-related messages");
cpmm.sendAsyncMessage("RIL:RegisterTelephonyMsg");
},
registerMobileConnectionMsg: function registerMobileConnectionMsg() {
debug("Registering for mobile connection-related messages");
registerMobileConnectionMsg: function registerMobileConnectionMsg(listener) {
debug("Registering for mobile connection related messages");
this.registerListener("_mobileConnectionListeners", listener);
cpmm.sendAsyncMessage("RIL:RegisterMobileConnectionMsg");
},
registerVoicemailMsg: function registerVoicemailMsg() {
unregisterMobileConnectionMsg: function unregisteMobileConnectionMsg(listener) {
this.unregisterListener("_mobileConnectionListeners", listener);
},
registerTelephonyMsg: function registerTelephonyMsg(listener) {
debug("Registering for telephony-related messages");
this.registerListener("_telephonyListeners", listener);
cpmm.sendAsyncMessage("RIL:RegisterTelephonyMsg");
},
unregisterTelephonyMsg: function unregisteTelephonyMsg(listener) {
this.unregisterListener("_telephonyListeners", listener);
// We also need to make sure the listener is removed from
// _enumerateTelephonyCallbacks.
let index = this._enumerateTelephonyCallbacks.indexOf(listener);
if (index != -1) {
this._enumerateTelephonyCallbacks.splice(index, 1);
if (DEBUG) debug("Unregistered enumerateTelephony callback: " + listener);
}
},
registerVoicemailMsg: function registerVoicemailMsg(listener) {
debug("Registering for voicemail-related messages");
this.registerListener("_voicemailListeners", listener);
cpmm.sendAsyncMessage("RIL:RegisterVoicemailMsg");
},
registerCellBroadcastMsg: function registerCellBroadcastMsg() {
unregisterVoicemailMsg: function unregisteVoicemailMsg(listener) {
this.unregisterListener("_voicemailListeners", listener);
},
registerCellBroadcastMsg: function registerCellBroadcastMsg(listener) {
debug("Registering for Cell Broadcast related messages");
this.registerListener("_cellBroadcastListeners", listener);
cpmm.sendAsyncMessage("RIL:RegisterCellBroadcastMsg");
},
unregisterCellBroadcastMsg: function unregisterCellBroadcastMsg(listener) {
this.unregisterListener("_cellBroadcastListeners", listener);
},
registerIccMsg: function registerIccMsg(listener) {
debug("Registering for ICC related messages");
this.registerListener("_iccListeners", listener);
cpmm.sendAsyncMessage("RIL:RegisterIccMsg");
},
unregisterIccMsg: function unregisterIccMsg(listener) {
this.unregisterListener("_iccListeners", listener);
},
enumerateCalls: function enumerateCalls(callback) {
debug("Requesting enumeration of calls for callback: " + callback);
// We need 'requestId' to meet the 'RILContentHelper <--> RadioInterfaceLayer'
@ -951,20 +955,27 @@ RILContentHelper.prototype = {
case "RIL:CardStateChanged":
if (this.rilContext.cardState != msg.json.cardState) {
this.rilContext.cardState = msg.json.cardState;
Services.obs.notifyObservers(null, kCardStateChangedTopic, null);
this._deliverEvent("_mobileConnectionListeners",
"notifyCardStateChanged",
null);
}
break;
case "RIL:IccInfoChanged":
this.updateInfo(msg.json, this.rilContext.iccInfo);
Services.obs.notifyObservers(null, kIccInfoChangedTopic, null);
this._deliverEvent("_mobileConnectionListeners",
"notifyIccInfoChanged", null);
break;
case "RIL:VoiceInfoChanged":
this.updateConnectionInfo(msg.json, this.rilContext.voiceConnectionInfo);
Services.obs.notifyObservers(null, kVoiceChangedTopic, null);
this._deliverEvent("_mobileConnectionListeners",
"notifyVoiceChanged",
null);
break;
case "RIL:DataInfoChanged":
this.updateConnectionInfo(msg.json, this.rilContext.dataConnectionInfo);
Services.obs.notifyObservers(null, kDataChangedTopic, null);
this._deliverEvent("_mobileConnectionListeners",
"notifyDataChanged",
null);
break;
case "RIL:EnumerateCalls":
this.handleEnumerateCalls(msg.json.calls);
@ -984,16 +995,15 @@ RILContentHelper.prototype = {
RIL.GECKO_NETWORK_SELECTION_AUTOMATIC);
break;
case "RIL:CallStateChanged":
this._deliverCallback("_telephonyCallbacks",
"callStateChanged",
[msg.json.callIndex, msg.json.state,
msg.json.number, msg.json.isActive]);
this._deliverEvent("_telephonyListeners",
"callStateChanged",
[msg.json.callIndex, msg.json.state,
msg.json.number, msg.json.isActive]);
break;
case "RIL:CallError":
this._deliverCallback("_telephonyCallbacks",
"notifyError",
[msg.json.callIndex,
msg.json.error]);
this._deliverEvent("_telephonyListeners",
"notifyError",
[msg.json.callIndex, msg.json.error]);
break;
case "RIL:VoicemailNotification":
this.handleVoicemailNotification(msg.json);
@ -1008,10 +1018,9 @@ RILContentHelper.prototype = {
} else {
if (msg.json.rilMessageType == "iccSetCardLock" ||
msg.json.rilMessageType == "iccUnlockCardLock") {
let result = JSON.stringify({lockType: msg.json.lockType,
retryCount: msg.json.retryCount});
Services.obs.notifyObservers(null, kIccCardLockErrorTopic,
result);
this._deliverEvent("_mobileConnectionListeners",
"notifyIccCardLockError",
[msg.json.lockType, msg.json.retryCount]);
}
this.fireRequestError(msg.json.requestId, msg.json.errorMsg);
}
@ -1019,7 +1028,9 @@ RILContentHelper.prototype = {
case "RIL:USSDReceived":
let res = JSON.stringify({message: msg.json.message,
sessionEnded: msg.json.sessionEnded});
Services.obs.notifyObservers(null, kUssdReceivedTopic, res);
this._deliverEvent("_mobileConnectionListeners",
"notifyUssdReceived",
[msg.json.message, msg.json.sessionEnded]);
break;
case "RIL:SendMMI:Return:OK":
case "RIL:CancelMMI:Return:OK":
@ -1033,11 +1044,11 @@ RILContentHelper.prototype = {
}
break;
case "RIL:StkCommand":
let jsonString = JSON.stringify(msg.json);
Services.obs.notifyObservers(null, kStkCommandTopic, jsonString);
this._deliverEvent("_iccListeners", "notifyStkCommand",
[JSON.stringify(msg.json)]);
break;
case "RIL:StkSessionEnd":
Services.obs.notifyObservers(null, kStkSessionEndTopic, null);
this._deliverEvent("_iccListeners", "notifyStkSessionEnd", null);
break;
case "RIL:IccOpenChannel":
this.handleIccOpenChannel(msg.json);
@ -1050,7 +1061,8 @@ RILContentHelper.prototype = {
break;
case "RIL:DataError":
this.updateConnectionInfo(msg.json, this.rilContext.dataConnectionInfo);
Services.obs.notifyObservers(null, kDataErrorTopic, msg.json.error);
this._deliverEvent("_mobileConnectionListeners", "notifyDataError",
[msg.json.error]);
break;
case "RIL:GetCallForwardingOption":
this.handleGetCallForwardingOption(msg.json);
@ -1059,19 +1071,17 @@ RILContentHelper.prototype = {
this.handleSetCallForwardingOption(msg.json);
break;
case "RIL:CfStateChanged":
let result = JSON.stringify({success: msg.json.success,
action: msg.json.action,
reason: msg.json.reason,
number: msg.json.number,
timeSeconds: msg.json.timeSeconds,
serviceClass: msg.json.serviceClass});
Services.obs.notifyObservers(null, kCfStateChangedTopic, result);
this._deliverEvent("_mobileConnectionListeners",
"notifyCFStateChange",
[msg.json.success, msg.json.action,
msg.json.reason, msg.json.number,
msg.json.timeSeconds, msg.json.serviceClass]);
break;
case "RIL:CellBroadcastReceived":
let message = new CellBroadcastMessage(msg.json);
this._deliverCallback("_cellBroadcastCallbacks",
"notifyMessageReceived",
[message]);
this._deliverEvent("_cellBroadcastListeners",
"notifyMessageReceived",
[message]);
break;
}
},
@ -1187,9 +1197,9 @@ RILContentHelper.prototype = {
}
if (changed) {
this._deliverCallback("_voicemailCallbacks",
"voicemailNotification",
[this.voicemailStatus]);
this._deliverEvent("_voicemailListeners",
"voicemailNotification",
[this.voicemailStatus]);
}
},
@ -1253,25 +1263,25 @@ RILContentHelper.prototype = {
return gUUIDGenerator.generateUUID().toString();
},
_deliverCallback: function _deliverCallback(callbackType, name, args) {
let thisCallbacks = this[callbackType];
if (!thisCallbacks) {
_deliverEvent: function _deliverEvent(listenerType, name, args) {
let thisListeners = this[listenerType];
if (!thisListeners) {
return;
}
let callbacks = thisCallbacks.slice();
for each (let callback in callbacks) {
if (thisCallbacks.indexOf(callback) == -1) {
let listeners = thisListeners.slice();
for each (let listener in listeners) {
if (thisListeners.indexOf(listener) == -1) {
continue;
}
let handler = callback[name];
let handler = listener[name];
if (typeof handler != "function") {
throw new Error("No handler for " + name);
}
try {
handler.apply(callback, args);
handler.apply(listener, args);
} catch (e) {
debug("callback handler for " + name + " threw an exception: " + e);
debug("listener for " + name + " threw an exception: " + e);
}
}
},

View File

@ -100,6 +100,7 @@ const RIL_IPC_MOBILECONNECTION_MSG_NAMES = [
"RIL:IccExchangeAPDU",
"RIL:IccCloseChannel",
"RIL:RegisterMobileConnectionMsg",
"RIL:RegisterIccMsg",
"RIL:SetCallForwardingOption",
"RIL:GetCallForwardingOption"
];
@ -314,9 +315,10 @@ function RadioInterfaceLayer() {
this._messageManagerByRequest = {};
// Manage message targets in terms of permission. Only the authorized and
// Manage message targets in terms of topic. Only the authorized and
// registered contents can receive related messages.
this._messageManagerByPermission = {};
this._messageManagerByTopic = {};
this._topicList = [];
ppmm.addMessageListener("child-process-shutdown", this);
for (let msgname of RIL_IPC_TELEPHONY_MSG_NAMES) {
@ -511,6 +513,9 @@ RadioInterfaceLayer.prototype = {
case "RIL:RegisterMobileConnectionMsg":
this.registerMessageTarget("mobileconnection", msg.target);
break;
case "RIL:RegisterIccMsg":
this.registerMessageTarget("icc", msg.target);
break;
case "RIL:RegisterVoicemailMsg":
this.registerMessageTarget("voicemail", msg.target);
break;
@ -610,7 +615,7 @@ RadioInterfaceLayer.prototype = {
break;
case "cardstatechange":
this.rilContext.cardState = message.cardState;
this._sendTargetMessage("mobileconnection", "RIL:CardStateChanged", message);
this._sendMobileConnectionMessage("RIL:CardStateChanged", message);
break;
case "setCallWaiting":
this.handleCallWaitingStatusChange(message);
@ -635,8 +640,7 @@ RadioInterfaceLayer.prototype = {
return;
case "cellbroadcast-received":
message.timestamp = Date.now();
this._sendTargetMessage("cellbroadcast", "RIL:CellBroadcastReceived",
message);
this._sendCellBroadcastMessage("RIL:CellBroadcastReceived", message);
break;
case "datacallstatechange":
this.handleDataCallState(message);
@ -700,7 +704,7 @@ RadioInterfaceLayer.prototype = {
this.handleStkProactiveCommand(message);
break;
case "stksessionend":
this._sendTargetMessage("mobileconnection", "RIL:StkSessionEnd", null);
this._sendIccMessage("RIL:StkSessionEnd", null);
break;
case "setPreferredNetworkType":
this.handleSetPreferredNetworkType(message);
@ -742,18 +746,15 @@ RadioInterfaceLayer.prototype = {
target.sendAsyncMessage(requestType, options);
},
_messageManagerByPermission: null,
_permissionList: null,
registerMessageTarget: function registerMessageTarget(permission, target) {
let targets = this._messageManagerByPermission[permission];
if (!this._permissionList) {
this._permissionList = [];
}
_messageManagerByTopic: null,
_topicList: null,
registerMessageTarget: function registerMessageTarget(topic, target) {
let targets = this._messageManagerByTopic[topic];
if (!targets) {
targets = this._messageManagerByPermission[permission] = [];
let list = this._permissionList;
if (list.indexOf(permission) == -1) {
list.push(permission);
targets = this._messageManagerByTopic[topic] = [];
let list = this._topicList;
if (list.indexOf(topic) == -1) {
list.push(topic);
}
}
@ -763,20 +764,20 @@ RadioInterfaceLayer.prototype = {
}
targets.push(target);
debug("Registered " + permission + " target: " + target);
debug("Registered " + topic + " target: " + target);
},
unregisterMessageTarget: function unregisterMessageTarget(permission, target) {
if (permission == null) {
// Unregister the target for every permission when no permission is specified.
for (let type of this._permissionList) {
unregisterMessageTarget: function unregisterMessageTarget(topic, target) {
if (topic == null) {
// Unregister the target for every topic when no topic is specified.
for (let type of this._topicList) {
this.unregisterMessageTarget(type, target);
}
return;
}
// Unregister the target for a specified permission.
let targets = this._messageManagerByPermission[permission];
// Unregister the target for a specified topic.
let targets = this._messageManagerByTopic[topic];
if (!targets) {
return;
}
@ -784,18 +785,18 @@ RadioInterfaceLayer.prototype = {
let index = targets.indexOf(target);
if (index != -1) {
targets.splice(index, 1);
debug("Unregistered " + permission + " target: " + target);
debug("Unregistered " + topic + " target: " + target);
}
},
_sendTargetMessage: function _sendTargetMessage(permission, message, options) {
_sendTargetMessage: function _sendTargetMessage(topic, message, options) {
if (!this._sysMsgListenerReady) {
this._enqueueTargetMessage(permission, message, options);
this._enqueueTargetMessage(topic, message, options);
return;
}
let targets = this._messageManagerByPermission[permission];
let targets = this._messageManagerByTopic[topic];
if (!targets) {
return;
}
@ -817,6 +818,14 @@ RadioInterfaceLayer.prototype = {
this._sendTargetMessage("voicemail", message, options);
},
_sendCellBroadcastMessage: function sendCellBroadcastMessage(message, options) {
this._sendTargetMessage("cellbroadcast", message, options);
},
_sendIccMessage: function sendIccMessage(message, options) {
this._sendTargetMessage("icc", message, options);
},
updateNetworkInfo: function updateNetworkInfo(message) {
let voiceMessage = message[RIL.NETWORK_INFO_VOICE_REGISTRATION_STATE];
let dataMessage = message[RIL.NETWORK_INFO_DATA_REGISTRATION_STATE];
@ -846,10 +855,10 @@ RadioInterfaceLayer.prototype = {
this.checkRoamingBetweenOperators(data);
if (voiceMessage || operatorMessage) {
this._sendTargetMessage("mobileconnection", "RIL:VoiceInfoChanged", voice);
this._sendMobileConnectionMessage("RIL:VoiceInfoChanged", voice);
}
if (dataMessage || operatorMessage) {
this._sendTargetMessage("mobileconnection", "RIL:DataInfoChanged", data);
this._sendMobileConnectionMessage("RIL:DataInfoChanged", data);
}
if (selectionMessage) {
@ -917,7 +926,7 @@ RadioInterfaceLayer.prototype = {
}
if (!newInfo.batch) {
this._sendTargetMessage("mobileconnection", "RIL:VoiceInfoChanged", voiceInfo);
this._sendMobileConnectionMessage("RIL:VoiceInfoChanged", voiceInfo);
}
},
@ -947,7 +956,7 @@ RadioInterfaceLayer.prototype = {
}
if (!newInfo.batch) {
this._sendTargetMessage("mobileconnection", "RIL:DataInfoChanged", dataInfo);
this._sendMobileConnectionMessage("RIL:DataInfoChanged", dataInfo);
}
this.updateRILNetworkInterface();
},
@ -958,7 +967,7 @@ RadioInterfaceLayer.prototype = {
handleDataCallError: function handleDataCallError(message) {
// Notify data call error only for data APN
if (message.apn == this.dataCallSettings["apn"]) {
this._sendTargetMessage("mobileconnection", "RIL:DataError", message);
this._sendMobileConnectionMessage("RIL:DataError", message);
}
this._deliverDataCallCallback("dataCallError", [message]);
@ -1025,7 +1034,7 @@ RadioInterfaceLayer.prototype = {
voiceInfo.relSignalStrength != message.gsmRelative) {
voiceInfo.signalStrength = message.gsmDBM;
voiceInfo.relSignalStrength = message.gsmRelative;
this._sendTargetMessage("mobileconnection", "RIL:VoiceInfoChanged", voiceInfo);
this._sendMobileConnectionMessage("RIL:VoiceInfoChanged", voiceInfo);
}
let dataInfo = this.rilContext.data;
@ -1033,7 +1042,7 @@ RadioInterfaceLayer.prototype = {
dataInfo.relSignalStrength != message.gsmRelative) {
dataInfo.signalStrength = message.gsmDBM;
dataInfo.relSignalStrength = message.gsmRelative;
this._sendTargetMessage("mobileconnection", "RIL:DataInfoChanged", dataInfo);
this._sendMobileConnectionMessage("RIL:DataInfoChanged", dataInfo);
}
},
@ -1064,14 +1073,14 @@ RadioInterfaceLayer.prototype = {
voice.network = message;
if (!message.batch) {
this._sendTargetMessage("mobileconnection", "RIL:VoiceInfoChanged", voice);
this._sendMobileConnectionMessage("RIL:VoiceInfoChanged", voice);
}
}
if (this.networkChanged(message, data.network)) {
data.network = message;
if (!message.batch) {
this._sendTargetMessage("mobileconnection", "RIL:DataInfoChanged", data);
this._sendMobileConnectionMessage("RIL:DataInfoChanged", data);
}
}
},
@ -1089,8 +1098,8 @@ RadioInterfaceLayer.prototype = {
this._ensureRadioState();
},
_enqueueTargetMessage: function _enqueueTargetMessage(permission, message, options) {
let msg = { permission : permission,
_enqueueTargetMessage: function _enqueueTargetMessage(topic, message, options) {
let msg = { topic : topic,
message : message,
options : options };
// Remove previous queued message of same message type, only one message
@ -1114,7 +1123,7 @@ RadioInterfaceLayer.prototype = {
// Dequeue and resend messages.
for each (let msg in this._targetMessageQueue) {
this._sendTargetMessage(msg.permission, msg.message, msg.options);
this._sendTargetMessage(msg.topic, msg.message, msg.options);
}
this._targetMessageQueue = null;
},
@ -1354,7 +1363,7 @@ RadioInterfaceLayer.prototype = {
gSystemMessenger.broadcastMessage("telephony-new-call", {});
}
this.updateCallAudioState(call);
this._sendTargetMessage("telephony", "RIL:CallStateChanged", call);
this._sendTelephonyMessage("RIL:CallStateChanged", call);
},
/**
@ -1372,7 +1381,7 @@ RadioInterfaceLayer.prototype = {
};
gSystemMessenger.broadcastMessage("telephony-call-ended", data);
this.updateCallAudioState(call);
this._sendTargetMessage("telephony", "RIL:CallStateChanged", call);
this._sendTelephonyMessage("RIL:CallStateChanged", call);
},
/**
@ -1426,7 +1435,7 @@ RadioInterfaceLayer.prototype = {
*/
updateNetworkSelectionMode: function updateNetworkSelectionMode(message) {
debug("updateNetworkSelectionMode: " + JSON.stringify(message));
this._sendTargetMessage("mobileconnection", "RIL:NetworkSelectionModeChanged", message);
this._sendMobileConnectionMessage("RIL:NetworkSelectionModeChanged", message);
},
/**
@ -1449,7 +1458,7 @@ RadioInterfaceLayer.prototype = {
* Handle call error.
*/
handleCallError: function handleCallError(message) {
this._sendTargetMessage("telephony", "RIL:CallError", message);
this._sendTelephonyMessage("RIL:CallError", message);
},
/**
@ -1527,7 +1536,7 @@ RadioInterfaceLayer.prototype = {
if (mwi) {
mwi.returnNumber = message.sender;
mwi.returnMessage = message.fullBody;
this._sendTargetMessage("voicemail", "RIL:VoicemailNotification", mwi);
this._sendVoicemailMessage("RIL:VoicemailNotification", mwi);
return true;
}
@ -1691,7 +1700,7 @@ RadioInterfaceLayer.prototype = {
if (datacall.ifname &&
datacall.apn == this.dataCallSettings["apn"]) {
data.connected = (datacall.state == RIL.GECKO_NETWORK_STATE_CONNECTED);
this._sendTargetMessage("mobileconnection", "RIL:DataInfoChanged", data);
this._sendMobileConnectionMessage("RIL:DataInfoChanged", data);
}
this._deliverDataCallCallback("dataCallStateChanged",
@ -1762,7 +1771,7 @@ RadioInterfaceLayer.prototype = {
voicemailInfo.number = message.number;
voicemailInfo.displayName = message.alphaId;
this._sendTargetMessage("voicemail", "RIL:VoicemailInfoChanged", voicemailInfo);
this._sendVoicemailMessage("RIL:VoicemailInfoChanged", voicemailInfo);
},
handleICCInfoChange: function handleICCInfoChange(message) {
@ -1782,7 +1791,7 @@ RadioInterfaceLayer.prototype = {
}
// RIL:IccInfoChanged corresponds to a DOM event that gets fired only
// when the MCC or MNC codes have changed.
this._sendTargetMessage("mobileconnection", "RIL:IccInfoChanged", message);
this._sendMobileConnectionMessage("RIL:IccInfoChanged", message);
// If spn becomes available, we should check roaming again.
let oldSpn = oldIccInfo ? oldIccInfo.spn : null;
@ -1794,10 +1803,10 @@ RadioInterfaceLayer.prototype = {
this.checkRoamingBetweenOperators(voice);
this.checkRoamingBetweenOperators(data);
if (voiceRoaming != voice.roaming) {
this._sendTargetMessage("mobileconnection", "RIL:VoiceInfoChanged", voice);
this._sendMobileConnectionMessage("RIL:VoiceInfoChanged", voice);
}
if (dataRoaming != data.roaming) {
this._sendTargetMessage("mobileconnection", "RIL:DataInfoChanged", data);
this._sendMobileConnectionMessage("RIL:DataInfoChanged", data);
}
}
},
@ -1809,7 +1818,7 @@ RadioInterfaceLayer.prototype = {
handleUSSDReceived: function handleUSSDReceived(ussd) {
debug("handleUSSDReceived " + JSON.stringify(ussd));
gSystemMessenger.broadcastMessage("ussd-received", ussd);
this._sendTargetMessage("mobileconnection", "RIL:USSDReceived", ussd);
this._sendMobileConnectionMessage("RIL:USSDReceived", ussd);
},
handleSendMMI: function handleSendMMI(message) {
@ -1829,7 +1838,7 @@ RadioInterfaceLayer.prototype = {
handleStkProactiveCommand: function handleStkProactiveCommand(message) {
debug("handleStkProactiveCommand " + JSON.stringify(message));
gSystemMessenger.broadcastMessage("icc-stkcommand", message);
this._sendTargetMessage("mobileconnection", "RIL:StkCommand", message);
this._sendIccMessage("RIL:StkCommand", message);
},
handleQueryCallForwardStatus: function handleQueryCallForwardStatus(message) {
@ -1839,7 +1848,7 @@ RadioInterfaceLayer.prototype = {
handleSetCallForward: function handleSetCallForward(message) {
debug("handleSetCallForward: " + JSON.stringify(message));
this._sendTargetMessage("mobileconnection", "RIL:CfStateChanged", message);
this._sendMobileConnectionMessage("RIL:CfStateChanged", message);
let messageType;
if (message.isSendMMI) {