diff --git a/dom/system/gonk/RadioInterfaceLayer.js b/dom/system/gonk/RadioInterfaceLayer.js index 2d50aaf434d..25263ae418b 100644 --- a/dom/system/gonk/RadioInterfaceLayer.js +++ b/dom/system/gonk/RadioInterfaceLayer.js @@ -216,6 +216,7 @@ function RadioInterfaceLayer() { radioState: RIL.GECKO_RADIOSTATE_UNAVAILABLE, cardState: RIL.GECKO_CARDSTATE_UNKNOWN, iccInfo: null, + imsi: null, // These objects implement the nsIDOMMozMobileConnectionInfo interface, // although the actual implementation lives in the content process. So are @@ -607,6 +608,9 @@ RadioInterfaceLayer.prototype = { case "iccinfochange": this.handleICCInfoChange(message); break; + case "iccimsi": + this.rilContext.imsi = message.imsi; + break; case "iccGetCardLock": case "iccSetCardLock": case "iccUnlockCardLock": diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js index 53fc02096b2..e003f463085 100644 --- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -793,7 +793,7 @@ let RIL = { this.iccInfoPrivate = {}; /** - * ICC information, such as MSISDN, IMSI, ...etc. + * ICC information, such as MSISDN, MCC, MNC, SPN...etc. */ this.iccInfo = {}; @@ -4355,7 +4355,14 @@ RIL[REQUEST_GET_IMSI] = function REQUEST_GET_IMSI(length, options) { return; } - this.iccInfo.imsi = Buf.readString(); + this.iccInfoPrivate.imsi = Buf.readString(); + if (DEBUG) { + debug("IMSI: " + this.iccInfoPrivate.imsi); + } + + options.rilMessageType = "iccimsi"; + options.imsi = this.iccInfoPrivate.imsi; + this.sendDOMMessage(options); }; RIL[REQUEST_HANGUP] = function REQUEST_HANGUP(length, options) { if (options.rilRequestError) { @@ -8851,22 +8858,23 @@ let ICCRecordHelper = { let length = Buf.readUint32(); // Each octet is encoded into two chars. let len = length / 2; - RIL.iccInfo.ad = GsmPDUHelper.readHexOctetArray(len); + let ad = GsmPDUHelper.readHexOctetArray(len); Buf.readStringDelimiter(length); if (DEBUG) { let str = ""; - for (let i = 0; i < RIL.iccInfo.ad.length; i++) { - str += RIL.iccInfo.ad[i] + ", "; + for (let i = 0; i < ad.length; i++) { + str += ad[i] + ", "; } debug("AD: " + str); } - if (RIL.iccInfo.imsi) { + let imsi = RIL.iccInfoPrivate.imsi; + if (imsi) { // MCC is the first 3 digits of IMSI. - RIL.iccInfo.mcc = parseInt(RIL.iccInfo.imsi.substr(0,3)); + RIL.iccInfo.mcc = parseInt(imsi.substr(0,3)); // The 4th byte of the response is the length of MNC. - RIL.iccInfo.mnc = parseInt(RIL.iccInfo.imsi.substr(3, RIL.iccInfo.ad[3])); + RIL.iccInfo.mnc = parseInt(imsi.substr(3, ad[3])); if (DEBUG) debug("MCC: " + RIL.iccInfo.mcc + " MNC: " + RIL.iccInfo.mnc); ICCUtilsHelper.handleICCInfoChange(); }