Bug 796277 - 0001.Save voicemail info in RIL. r=hsinyi

This commit is contained in:
Chuck Lee 2012-11-23 12:09:01 +08:00
parent 6247c94cd0
commit 0832e7dfc7
2 changed files with 36 additions and 8 deletions

View File

@ -60,7 +60,7 @@ const RIL_IPC_MSG_NAMES = [
"RIL:SelectNetworkAuto",
"RIL:CallStateChanged",
"RIL:VoicemailNotification",
"RIL:VoicemailNumberChanged",
"RIL:VoicemailInfoChanged",
"RIL:CallError",
"RIL:CardLockResult",
"RIL:USSDReceived",
@ -123,7 +123,13 @@ MobileICCInfo.prototype = {
mcc: 0,
mnc: 0,
spn: null,
msisdn: null,
msisdn: null
};
function MobileVoicemailInfo() {}
MobileVoicemailInfo.prototype = {
number: null,
displayName: null
};
function MobileConnectionInfo() {}
@ -241,6 +247,7 @@ function RILContentHelper() {
this.iccInfo = new MobileICCInfo();
this.voiceConnectionInfo = new MobileConnectionInfo();
this.dataConnectionInfo = new MobileConnectionInfo();
this.voicemailInfo = new MobileVoicemailInfo();
this.initRequests();
this.initMessageListener(RIL_IPC_MSG_NAMES);
@ -257,6 +264,7 @@ function RILContentHelper() {
this.updateICCInfo(rilContext.icc, this.iccInfo);
this.updateConnectionInfo(rilContext.voice, this.voiceConnectionInfo);
this.updateConnectionInfo(rilContext.data, this.dataConnectionInfo);
this.updateVoicemailInfo(rilContext.voicemail, this.voicemailInfo);
}
RILContentHelper.prototype = {
@ -271,6 +279,12 @@ RILContentHelper.prototype = {
interfaces: [Ci.nsIMobileConnectionProvider,
Ci.nsIRILContentHelper]}),
updateVoicemailInfo: function updateVoicemailInfo(srcInfo, destInfo) {
for (let key in srcInfo) {
destInfo[key] = srcInfo[key];
}
},
updateICCInfo: function updateICCInfo(srcInfo, destInfo) {
for (let key in srcInfo) {
destInfo[key] = srcInfo[key];
@ -553,8 +567,12 @@ RILContentHelper.prototype = {
_enumerateTelephonyCallbacks: null,
voicemailStatus: null,
voicemailNumber: null,
voicemailDisplayName: null,
get voicemailNumber() {
return this.voicemailInfo.number;
},
get voicemailDisplayName() {
return this.voicemailInfo.displayName;
},
registerCallback: function registerCallback(callbackType, callback) {
let callbacks = this[callbackType];
@ -797,9 +815,8 @@ RILContentHelper.prototype = {
case "RIL:VoicemailNotification":
this.handleVoicemailNotification(msg.json);
break;
case "RIL:VoicemailNumberChanged":
this.voicemailNumber = msg.json.number;
this.voicemailDisplayName = msg.json.alphaId;
case "RIL:VoicemailInfoChanged":
this.updateVoicemailInfo(msg.json, this.voicemailInfo);
break;
case "RIL:CardLockResult":
if (msg.json.success) {

View File

@ -194,6 +194,8 @@ function RadioInterfaceLayer() {
radioState: RIL.GECKO_RADIOSTATE_UNAVAILABLE,
cardState: RIL.GECKO_CARDSTATE_UNAVAILABLE,
icc: null,
voicemail: {number: null,
displayName: null},
// These objects implement the nsIDOMMozMobileConnectionInfo interface,
// although the actual implementation lives in the content process. So are
@ -568,7 +570,7 @@ RadioInterfaceLayer.prototype = {
}
break;
case "iccmbdn":
this._sendTargetMessage("voicemail", "RIL:VoicemailNumberChanged", message);
this.handleICCMbdn(message);
break;
case "USSDReceived":
debug("USSDReceived " + JSON.stringify(message));
@ -1477,6 +1479,15 @@ RadioInterfaceLayer.prototype = {
}
},
handleICCMbdn: function handleICCMbdn(message) {
let voicemail = this.rilContext.voicemail;
voicemail.number = message.number;
voicemail.displayName = message.alphaId;
this._sendTargetMessage("voicemail", "RIL:VoicemailInfoChanged", voicemail);
},
handleICCInfoChange: function handleICCInfoChange(message) {
let oldIcc = this.rilContext.icc;
this.rilContext.icc = message;