Bug 743150 - Part 3: Handle supplementary service notification in RIL. r=hsinyi

This commit is contained in:
Szu-Yu Chen [:aknow] 2013-08-05 16:28:31 -04:00
parent 7c0dd8c2fa
commit 85b464021b
4 changed files with 94 additions and 1 deletions

View File

@ -78,6 +78,7 @@ const RIL_IPC_MSG_NAMES = [
"RIL:VoicemailNotification",
"RIL:VoicemailInfoChanged",
"RIL:CallError",
"RIL:SuppSvcNotification",
"RIL:CardLockResult",
"RIL:CardLockRetryCount",
"RIL:USSDReceived",
@ -1475,6 +1476,11 @@ RILContentHelper.prototype = {
[data.callIndex, data.errorMsg]);
break;
}
case "RIL:SuppSvcNotification":
this._deliverEvent("_telephonyListeners",
"supplementaryServiceNotification",
[msg.json.callIndex, msg.json.notification]);
break;
case "RIL:VoicemailNotification":
this.handleVoicemailNotification(msg.json.data);
break;

View File

@ -209,6 +209,17 @@ function convertRILCallState(state) {
}
}
function convertRILSuppSvcNotification(notification) {
switch (notification) {
case RIL.GECKO_SUPP_SVC_NOTIFICATION_REMOTE_HELD:
return nsITelephonyProvider.NOTIFICATION_REMOTE_HELD;
case RIL.GECKO_SUPP_SVC_NOTIFICATION_REMOTE_RESUMED:
return nsITelephonyProvider.NOTIFICATION_REMOTE_RESUMED;
default:
throw new Error("Unknown rilSuppSvcNotification: " + notification);
}
}
/**
* Fake nsIAudioManager implementation so that we can run the telephony
* code in a non-Gonk build.
@ -939,6 +950,9 @@ RadioInterface.prototype = {
case "callError":
this.handleCallError(message);
break;
case "suppSvcNotification":
this.handleSuppSvcNotification(message);
break;
case "iccOpenChannel":
this.handleIccOpenChannel(message);
break;
@ -1810,6 +1824,14 @@ RadioInterface.prototype = {
this.clientId, message);
},
/**
* Handle supplementary service notification.
*/
handleSuppSvcNotification: function handleSuppSvcNotification(message) {
message.notification = convertRILSuppSvcNotification(message.notification);
this._sendTelephonyMessage("RIL:SuppSvcNotification", message);
},
/**
* Handle WDP port push PDU. Constructor WDP bearer information and deliver
* to WapPushManager.

View File

@ -2767,5 +2767,16 @@ this.MCC_TABLE_FOR_MNC_LENGTH_IS_3 = [
"750" // Falkland Islands (Malvinas)
];
// Supplementary service notifications, code2, as defined in 3GPP 27.007 7.17
this.SUPP_SVC_NOTIFICATION_CODE2_PUT_ON_HOLD = 2;
this.SUPP_SVC_NOTIFICATION_CODE2_RETRIEVED = 3;
this.GECKO_SUPP_SVC_NOTIFICATION_REMOTE_HELD = "RemoteHeld";
this.GECKO_SUPP_SVC_NOTIFICATION_REMOTE_RESUMED = "RemoteResumed";
this.GECKO_SUPP_SVC_NOTIFICATION_FROM_CODE2 = {};
GECKO_SUPP_SVC_NOTIFICATION_FROM_CODE2[SUPP_SVC_NOTIFICATION_CODE2_PUT_ON_HOLD] = GECKO_SUPP_SVC_NOTIFICATION_REMOTE_HELD;
GECKO_SUPP_SVC_NOTIFICATION_FROM_CODE2[SUPP_SVC_NOTIFICATION_CODE2_RETRIEVED] = GECKO_SUPP_SVC_NOTIFICATION_REMOTE_RESUMED;
// Allow this file to be imported via Components.utils.import().
this.EXPORTED_SYMBOLS = Object.keys(this);

View File

@ -3848,6 +3848,51 @@ let RIL = {
}
},
_processSuppSvcNotification: function _processSuppSvcNotification(info) {
debug("handle supp svc notification: " + JSON.stringify(info));
let notification = null;
let callIndex = -1;
if (info.notificationType === 0) {
// MO intermediate result code. Refer to code1 defined in 3GPP 27.007
// 7.17.
} else if (info.notificationType === 1) {
// MT unsolicited result code. Refer to code2 defined in 3GPP 27.007 7.17.
switch (info.code) {
case SUPP_SVC_NOTIFICATION_CODE2_PUT_ON_HOLD:
case SUPP_SVC_NOTIFICATION_CODE2_RETRIEVED:
notification = GECKO_SUPP_SVC_NOTIFICATION_FROM_CODE2[info.code];
break;
default:
// Notification type not supported.
return;
}
// Get the target call object for this notification.
let currentCallIndexes = Object.keys(this.currentCalls);
if (currentCallIndexes.length === 1) {
// Only one call exists. This should be the target.
callIndex = currentCallIndexes[0];
} else {
// Find the call in |currentCalls| by the given number.
if (info.number) {
for each (let currentCall in this.currentCalls) {
if (currentCall.number == info.number) {
callIndex = currentCall.callIndex;
break;
}
}
}
}
}
let message = {rilMessageType: "suppSvcNotification",
notification: notification,
callIndex: callIndex};
this.sendChromeMessage(message);
},
_processNetworks: function _processNetworks() {
let strings = Buf.readStringList();
let networks = [];
@ -6011,7 +6056,16 @@ RIL[UNSOLICITED_DATA_CALL_LIST_CHANGED] = function UNSOLICITED_DATA_CALL_LIST_CH
}
this[REQUEST_DATA_CALL_LIST](length, {rilRequestError: ERROR_SUCCESS});
};
RIL[UNSOLICITED_SUPP_SVC_NOTIFICATION] = null;
RIL[UNSOLICITED_SUPP_SVC_NOTIFICATION] = function UNSOLICITED_SUPP_SVC_NOTIFICATION(length) {
let info = {};
info.notificationType = Buf.readUint32();
info.code = Buf.readUint32();
info.index = Buf.readUint32();
info.type = Buf.readUint32();
info.number = Buf.readString();
this._processSuppSvcNotification(info);
};
RIL[UNSOLICITED_STK_SESSION_END] = function UNSOLICITED_STK_SESSION_END() {
this.sendChromeMessage({rilMessageType: "stksessionend"});