Bug 820762 - 0002.Access voicmail info with correct permission. r=hsinyi

This commit is contained in:
Chuck Lee 2012-12-26 18:49:08 +08:00
parent 6b34770bf6
commit f948debdbe
2 changed files with 33 additions and 13 deletions

View File

@ -136,8 +136,8 @@ MobileICCInfo.prototype = {
msisdn: null
};
function MobileVoicemailInfo() {}
MobileVoicemailInfo.prototype = {
function VoicemailInfo() {}
VoicemailInfo.prototype = {
number: null,
displayName: null
};
@ -319,7 +319,7 @@ function RILContentHelper() {
this.iccInfo = new MobileICCInfo();
this.voiceConnectionInfo = new MobileConnectionInfo();
this.dataConnectionInfo = new MobileConnectionInfo();
this.voicemailInfo = new MobileVoicemailInfo();
this.voicemailInfo = new VoicemailInfo();
this.initRequests();
this.initMessageListener(RIL_IPC_MSG_NAMES);
@ -336,7 +336,6 @@ 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 = {
@ -651,11 +650,25 @@ RILContentHelper.prototype = {
_enumerateTelephonyCallbacks: null,
voicemailStatus: null,
getVoicemailInfo: function getVoicemailInfo() {
// Get voicemail infomation by IPC only on first time.
this.getVoicemailInfo = function getVoicemailInfo() {
return this.voicemailInfo;
};
let voicemailInfo = cpmm.sendSyncMessage("RIL:GetVoicemailInfo")[0];
if (voicemailInfo) {
this.updateVoicemailInfo(voicemailInfo, this.voicemailInfo);
}
return this.voicemailInfo;
},
get voicemailNumber() {
return this.voicemailInfo.number;
return this.getVoicemailInfo().number;
},
get voicemailDisplayName() {
return this.voicemailInfo.displayName;
return this.getVoicemailInfo().displayName;
},
registerCallback: function registerCallback(callbackType, callback) {

View File

@ -99,7 +99,8 @@ const RIL_IPC_MOBILECONNECTION_MSG_NAMES = [
];
const RIL_IPC_VOICEMAIL_MSG_NAMES = [
"RIL:RegisterVoicemailMsg"
"RIL:RegisterVoicemailMsg",
"RIL:GetVoicemailInfo"
];
const RIL_IPC_CELLBROADCAST_MSG_NAMES = [
@ -204,8 +205,6 @@ 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
@ -229,6 +228,11 @@ function RadioInterfaceLayer() {
relSignalStrength: null},
};
this.voicemailInfo = {
number: null,
displayName: null
};
this.callWaitingStatus = null;
// Read the 'ril.radio.disabled' setting in order to start with a known
@ -479,6 +483,9 @@ RadioInterfaceLayer.prototype = {
case "RIL:RegisterCellBroadcastMsg":
this.registerMessageTarget("cellbroadcast", msg.target);
break;
case "RIL:GetVoicemailInfo":
// This message is sync.
return this.voicemailInfo;
}
},
@ -1576,12 +1583,12 @@ RadioInterfaceLayer.prototype = {
},
handleICCMbdn: function handleICCMbdn(message) {
let voicemail = this.rilContext.voicemail;
let voicemailInfo = this.voicemailInfo;
voicemail.number = message.number;
voicemail.displayName = message.alphaId;
voicemailInfo.number = message.number;
voicemailInfo.displayName = message.alphaId;
this._sendTargetMessage("voicemail", "RIL:VoicemailInfoChanged", voicemail);
this._sendTargetMessage("voicemail", "RIL:VoicemailInfoChanged", voicemailInfo);
},
handleICCInfoChange: function handleICCInfoChange(message) {