Back out 421ed10b0e81(Bug 762760 - Part 2) for wrong Bug number in comment
authorYoshi Huang <yhuang@mozilla.com>
Tue, 19 Jun 2012 16:57:12 +0800
changeset 99730 06aa6175c28b41d3d78c6e228dfc48f62922601f
parent 99729 e2a44838954acb29f353d2f6c08f54ccf614176e
child 99731 d509d8abf5ba2c7656a176fe8eb259d44f9b3bc4
push id1729
push userlsblakk@mozilla.com
push dateMon, 16 Jul 2012 20:02:43 +0000
treeherdermozilla-aurora@f4e75e148951 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs762760
milestone16.0a1
backs out421ed10b0e817c04dd6aef4611fc4027b15b5aa0
Back out 421ed10b0e81(Bug 762760 - Part 2) for wrong Bug number in comment
dom/sms/src/ril/SmsDatabaseService.js
dom/system/gonk/RadioInterfaceLayer.js
dom/system/gonk/ril_worker.js
--- a/dom/sms/src/ril/SmsDatabaseService.js
+++ b/dom/sms/src/ril/SmsDatabaseService.js
@@ -344,26 +344,26 @@ SmsDatabaseService.prototype = {
 
   /**
    * nsISmsDatabaseService API
    */
 
   saveReceivedMessage: function saveReceivedMessage(sender, body, date) {
     let message = {delivery:  DELIVERY_RECEIVED,
                    sender:    sender,
-                   receiver:  this.mRIL.rilContext.icc.msisdn, 
+                   receiver:  this.mRIL.radioState.msisdn, 
                    body:      body,
                    timestamp: date,
                    read:      FILTER_READ_UNREAD};
     return this.saveMessage(message);
   },
 
   saveSentMessage: function saveSentMessage(receiver, body, date) {
     let message = {delivery:  DELIVERY_SENT,
-                   sender:    this.mRIL.rilContext.icc.msisdn,
+                   sender:    this.mRIL.radioState.msisdn,
                    receiver:  receiver,
                    body:      body,
                    timestamp: date,
                    read:      FILTER_READ_READ};
     return this.saveMessage(message);
   },
 
   getMessage: function getMessage(messageId, requestId) {
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -25,17 +25,17 @@ const nsIRadioInterfaceLayer = Ci.nsIRad
 const kNetworkInterfaceStateChangedTopic = "network-interface-state-changed";
 const kSmsReceivedObserverTopic          = "sms-received";
 const kSmsDeliveredObserverTopic         = "sms-delivered";
 const kMozSettingsChangedObserverTopic   = "mozsettings-changed";
 const DOM_SMS_DELIVERY_RECEIVED          = "received";
 const DOM_SMS_DELIVERY_SENT              = "sent";
 
 const RIL_IPC_MSG_NAMES = [
-  "RIL:GetRilContext",
+  "RIL:GetRadioState",
   "RIL:EnumerateCalls",
   "RIL:GetMicrophoneMuted",
   "RIL:SetMicrophoneMuted",
   "RIL:GetSpeakerEnabled",
   "RIL:SetSpeakerEnabled",
   "RIL:StartTone",
   "RIL:StopTone",
   "RIL:Dial",
@@ -141,32 +141,32 @@ DataCallInfo.protoptype = {
 
 
 function RadioInterfaceLayer() {
   debug("Starting RIL Worker");
   this.worker = new ChromeWorker("resource://gre/modules/ril_worker.js");
   this.worker.onerror = this.onerror.bind(this);
   this.worker.onmessage = this.onmessage.bind(this);
 
-  this.rilContext = {
+  this.radioState = {
     radioState:     RIL.GECKO_RADIOSTATE_UNAVAILABLE,
     cardState:      RIL.GECKO_CARDSTATE_UNAVAILABLE,
     icc:            null,
     cell:           null,
 
     // These objects implement the nsIDOMMozMobileConnectionInfo interface,
     // although the actual implementation lives in the content process.
     voice:          {connected: false,
                      emergencyCallsOnly: false,
                      roaming: false,
                      network: null,
                      type: null,
                      signalStrength: null,
                      relSignalStrength: null},
-    data:           {connected: false,
+    data:          {connected: false,
                      emergencyCallsOnly: false,
                      roaming: false,
                      network: null,
                      type: null,
                      signalStrength: null,
                      relSignalStrength: null},
   };
 
@@ -199,19 +199,19 @@ RadioInterfaceLayer.prototype = {
                                          Ci.nsISettingsServiceCallback]),
 
   /**
    * Process a message from the content process.
    */
   receiveMessage: function receiveMessage(msg) {
     debug("Received '" + msg.name + "' message from content process");
     switch (msg.name) {
-      case "RIL:GetRilContext":
+      case "RIL:GetRadioState":
         // This message is sync.
-        return this.rilContext;
+        return this.radioState;
       case "RIL:EnumerateCalls":
         this.enumerateCalls();
         break;
       case "RIL:GetMicrophoneMuted":
         // This message is sync.
         return this.microphoneMuted;
       case "RIL:SetMicrophoneMuted":
         this.microphoneMuted = msg.json;
@@ -319,17 +319,17 @@ RadioInterfaceLayer.prototype = {
         break;
       case "operatorchange":
         this.handleOperatorChange(message);
         break;
       case "radiostatechange":
         this.handleRadioStateChange(message);
         break;
       case "cardstatechange":
-        this.rilContext.cardState = message.cardState;
+        this.radioState.cardState = message.cardState;
         ppmm.sendAsyncMessage("RIL:CardStateChanged", message);
         break;
       case "sms-received":
         this.handleSmsReceived(message);
         return;
       case "sms-sent":
         this.handleSmsSent(message);
         return;
@@ -354,17 +354,17 @@ RadioInterfaceLayer.prototype = {
         // sent from the network and a timestamp of when the message was received
         // so an offset can be added if/when the time is actually set.
         debug("nitzTime networkTime=" + message.networkTimeInSeconds +
               " timezone=" + message.networkTimeZoneInMinutes +
               " dst=" + message.dstFlag +
               " timestamp=" + message.localTimeStampInMS);
         break;
       case "iccinfochange":
-        this.rilContext.icc = message;
+        this.radioState.icc = message;
         break;
       case "iccgetcardlock":
         this.handleICCGetCardLock(message);
         break;
       case "iccsetcardlock":
         this.handleICCSetCardLock(message);
         break;
       case "iccunlockcardlock":
@@ -376,17 +376,17 @@ RadioInterfaceLayer.prototype = {
         }
         let callback = this._contactsCallbacks[message.requestId];
         if (callback) {
           delete this._contactsCallbacks[message.requestId];
           callback.receiveContactsList(message.contactType, message.contacts);
         }
         break;
       case "celllocationchanged":
-        this.rilContext.cell = message;
+        this.radioState.cell = message;
         break;
       case "ussdreceived":
         debug("ussdreceived " + JSON.stringify(message));
         this.handleUSSDReceived(message);
         break;
       case "sendussd":
         this.handleSendUSSD(message);
         break;
@@ -394,17 +394,17 @@ RadioInterfaceLayer.prototype = {
         this.handleCancelUSSD(message);
         break;
       default:
         throw new Error("Don't know about this message type: " + message.type);
     }
   },
 
   updateVoiceConnection: function updateVoiceConnection(state) {
-    let voiceInfo = this.rilContext.voice;
+    let voiceInfo = this.radioState.voice;
     voiceInfo.type = "gsm"; //TODO see bug 726098.
     if (!state || state.regState == RIL.NETWORK_CREG_STATE_UNKNOWN) {
       voiceInfo.connected = false;
       voiceInfo.emergencyCallsOnly = false;
       voiceInfo.roaming = false;
       voiceInfo.network = null;
       voiceInfo.type = null;
       voiceInfo.signalStrength = null;
@@ -461,78 +461,78 @@ RadioInterfaceLayer.prototype = {
     }
     //TODO need to keep track of some of the state information, and then
     // notify the content when state changes (connected, technology
     // changes, etc.). This should be done in RILNetworkInterface.
   },
 
   handleSignalStrengthChange: function handleSignalStrengthChange(message) {
     // TODO CDMA, EVDO, LTE, etc. (see bug 726098)
-    this.rilContext.voice.signalStrength = message.gsmDBM;
-    this.rilContext.voice.relSignalStrength = message.gsmRelative;
-    ppmm.sendAsyncMessage("RIL:VoiceInfoChanged", this.rilContext.voice);
+    this.radioState.voice.signalStrength = message.gsmDBM;
+    this.radioState.voice.relSignalStrength = message.gsmRelative;
+    ppmm.sendAsyncMessage("RIL:VoiceInfoChanged", this.radioState.voice);
 
-    this.rilContext.data.signalStrength = message.gsmDBM;
-    this.rilContext.data.relSignalStrength = message.gsmRelative;
-    ppmm.sendAsyncMessage("RIL:DataInfoChanged", this.rilContext.data);
+    this.radioState.data.signalStrength = message.gsmDBM;
+    this.radioState.data.relSignalStrength = message.gsmRelative;
+    ppmm.sendAsyncMessage("RIL:DataInfoChanged", this.radioState.data);
   },
 
   networkChanged: function networkChanged(srcNetwork, destNetwork) {
     return !destNetwork ||
       destNetwork.longName != srcNetwork.longName ||
       destNetwork.shortName != srcNetwork.shortName ||
       destNetwork.mnc != srcNetwork.mnc ||
       destNetwork.mcc != srcNetwork.mcc;
   },
 
   handleOperatorChange: function handleOperatorChange(message) {
-    let voice = this.rilContext.voice;
-    let data = this.rilContext.data;
+    let voice = this.radioState.voice;
+    let data = this.radioState.data;
 
     if (this.networkChanged(message, voice.network)) {
       voice.network = message;
       ppmm.sendAsyncMessage("RIL:VoiceInfoChanged", voice);
     }
 
     if (this.networkChanged(message, data.network)) {
       data.network = message;
       ppmm.sendAsyncMessage("RIL:DataInfoChanged", data);
     }
   },
 
   handleRadioStateChange: function handleRadioStateChange(message) {
     let newState = message.radioState;
-    if (this.rilContext.radioState == newState) {
+    if (this.radioState.radioState == newState) {
       return;
     }
-    this.rilContext.radioState = newState;
+    this.radioState.radioState = newState;
     //TODO Should we notify this change as a card state change?
 
     this._ensureRadioState();
   },
 
   _ensureRadioState: function _ensureRadioState() {
-    debug("Reported radio state is " + this.rilContext.radioState +
+    debug("Reported radio state is " + this.radioState.radioState +
           ", desired radio enabled state is " + this._radioEnabled);
     if (this._radioEnabled == null) {
       // We haven't read the initial value from the settings DB yet.
       // Wait for that.
       return;
     }
-    if (this.rilContext.radioState == RIL.GECKO_RADIOSTATE_UNKNOWN) {
+    if (this.radioState.radioState == RIL.GECKO_RADIOSTATE_UNKNOWN) {
       // We haven't received a radio state notification from the RIL
       // yet. Wait for that.
       return;
     }
 
-    if (this.rilContext.radioState == RIL.GECKO_RADIOSTATE_OFF &&
+    if (this.radioState.radioState == RIL.GECKO_RADIOSTATE_OFF &&
         this._radioEnabled) {
       this.setRadioEnabled(true);
     }
-    if (this.rilContext.radioState == RIL.GECKO_RADIOSTATE_READY &&
+    if (this.radioState.radioState == RIL.GECKO_RADIOSTATE_READY &&
         !this._radioEnabled) {
       this.setRadioEnabled(false);
     }
   },
 
   /**
    * Track the active call and update the audio system as its state changes.
    */
@@ -632,17 +632,17 @@ RadioInterfaceLayer.prototype = {
       debug("Got port addressed SMS but not encoded in 8-bit alphabet. Drop!");
       return;
     }
 
     let options = {
       bearer: WAP.WDP_BEARER_GSM_SMS_GSM_MSISDN,
       sourceAddress: message.sender,
       sourcePort: message.header.originatorPort,
-      destinationAddress: this.rilContext.icc.msisdn,
+      destinationAddress: this.radioState.icc.MSISDN,
       destinationPort: message.header.destinationPort,
     };
     WAP.WapPushManager.receiveWdpPDU(message.fullData, message.fullData.length,
                                      0, options);
   },
 
   portAddressedSmsApps: null,
   handleSmsReceived: function handleSmsReceived(message) {
@@ -885,17 +885,17 @@ RadioInterfaceLayer.prototype = {
 
   // nsIRadioInterfaceLayer
 
   setRadioEnabled: function setRadioEnabled(value) {
     debug("Setting radio power to " + value);
     this.worker.postMessage({type: "setRadioPower", on: value});
   },
 
-  rilContext: null,
+  radioState: null,
 
   // Handle phone functions of nsIRILContentHelper
 
   enumerateCalls: function enumerateCalls() {
     debug("Requesting enumeration of calls for callback");
     this.worker.postMessage({type: "enumerateCalls"});
   },
 
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -995,21 +995,21 @@ let RIL = {
                         PDU_HEX_OCTET_SIZE);
 
       // Dialling Number/SSC String
       let len = GsmPDUHelper.readHexOctet();
       if (len > MSISDN_MAX_NUMBER_SIZE_BYTES) {
         debug("ICC_EF_MSISDN: invalid length of BCD number/SSC contents - " + len);
         return;
       }
-      this.iccInfo.msisdn = GsmPDUHelper.readDiallingNumber(len);
+      this.iccInfo.MSISDN = GsmPDUHelper.readDiallingNumber(len);
       Buf.readStringDelimiter(length);
 
-      if (DEBUG) debug("MSISDN: " + this.iccInfo.msisdn);
-      if (this.iccInfo.msisdn) {
+      if (DEBUG) debug("MSISDN: " + this.iccInfo.MSISDN);
+      if (this.iccInfo.MSISDN) {
         this._handleICCInfoChange();
       }
     }
 
     this.iccIO({
       command:   ICC_COMMAND_GET_RESPONSE,
       fileId:    ICC_EF_MSISDN,
       pathId:    EF_PATH_MF_SIM + EF_PATH_DF_TELECOM,
@@ -1019,40 +1019,40 @@ let RIL = {
       data:      null,
       pin2:      null,
       type:      EF_TYPE_LINEAR_FIXED,
       callback:  callback,
     });
   },
 
   /**
-   * Read the AD (Administrative Data) from the ICC.
+   * Read the AD from the ICC.
    */
   getAD: function getAD() {
     function callback() {
       let length = Buf.readUint32();
       // Each octet is encoded into two chars.
       let len = length / 2;
-      this.iccInfo.ad = GsmPDUHelper.readHexOctetArray(len);
+      this.iccInfo.AD = GsmPDUHelper.readHexOctetArray(len);
       Buf.readStringDelimiter(length);
 
       if (DEBUG) {
         let str = "";
-        for (let i = 0; i < this.iccInfo.ad.length; i++) {
-          str += this.iccInfo.ad[i] + ", ";
+        for (let i = 0; i < this.iccInfo.AD.length; i++) {
+          str += this.iccInfo.AD[i] + ", ";
         }
         debug("AD: " + str);
       }
 
-      if (this.iccInfo.imsi) {
+      if (this.iccInfo.IMSI) {
         // MCC is the first 3 digits of IMSI
-        this.iccInfo.mcc = parseInt(this.iccInfo.imsi.substr(0,3));
+        this.iccInfo.MCC = this.iccInfo.IMSI.substr(0,3);
         // The 4th byte of the response is the length of MNC
-        this.iccInfo.mnc = parseInt(this.iccInfo.imsi.substr(3, this.iccInfo.ad[3]));
-        if (DEBUG) debug("MCC: " + this.iccInfo.mcc + " MNC: " + this.iccInfo.mnc);
+        this.iccInfo.MNC = this.iccInfo.IMSI.substr(3, this.iccInfo.AD[3]);
+        if (DEBUG) debug("MCC: " + this.iccInfo.MCC + " MNC: " + this.iccInfo.MNC);
         this._handleICCInfoChange();
       }
     }
 
     this.iccIO({
       command:   ICC_COMMAND_GET_RESPONSE,
       fileId:    ICC_EF_AD,
       pathId:    EF_PATH_MF_SIM + EF_PATH_DF_GSM,
@@ -1074,36 +1074,34 @@ let RIL = {
    * @return
    *        true if the service is enabled,
    *        false otherwise.
    */
   isUSTServiceAvailable: function isUSTServiceAvailable(service) {
     service -= 1;
     let index = service / 8;
     let bitmask = 1 << (service % 8);
-    return this.iccInfo.ust &&
-           (index < this.iccInfo.ust.length) &&
-           (this.iccInfo.ust[index] & bitmask);
+    return this.UST && (index < this.UST.length) && (this.UST[index] & bitmask);
   },
 
   /**
    * Read the UST from the ICC.
    */
   getUST: function getUST() {
     function callback() {
       let length = Buf.readUint32();
       // Each octet is encoded into two chars.
       let len = length / 2;
-      this.iccInfo.ust = GsmPDUHelper.readHexOctetArray(len);
+      this.iccInfo.UST = GsmPDUHelper.readHexOctetArray(len);
       Buf.readStringDelimiter(length);
       
       if (DEBUG) {
         let str = "";
-        for (let i = 0; i < this.iccInfo.ust.length; i++) {
-          str += this.iccInfo.ust[i] + ", ";
+        for (let i = 0; i < this.iccInfo.UST.length; i++) {
+          str += this.iccInfo.UST[i] + ", ";
         }
         debug("UST: " + str);
       }
     }
 
     this.iccIO({
       command:   ICC_COMMAND_GET_RESPONSE,
       fileId:    ICC_EF_UST,
@@ -1179,34 +1177,34 @@ let RIL = {
    *  Get ICC FDN.
    *
    *  @paran requestId
    *         Request id from RadioInterfaceLayer.
    */
   getFDN: function getFDN(options) {
     function callback(options) {
       function add(contact) {
-        this.iccInfo.fdn.push(contact);
+        this.iccInfo.FDN.push(contact);
       };
       function finish() {
         if (DEBUG) {
-          for (let i = 0; i < this.iccInfo.fdn.length; i++) {
-            debug("FDN[" + i + "] alphaId = " + this.iccInfo.fdn[i].alphaId +
-                                " number = " + this.iccInfo.fdn[i].number);
+          for (let i = 0; i < this.iccInfo.FDN.length; i++) {
+            debug("FDN[" + i + "] alphaId = " + this.iccInfo.FDN[i].alphaId +
+                                " number = " + this.iccInfo.FDN[i].number);
           }
         }
         this.sendDOMMessage({type: "icccontacts",
                              contactType: "FDN",
-                             contacts: this.iccInfo.fdn,
+                             contacts: this.iccInfo.FDN,
                              requestId: options.requestId});
       };
       this.parseDiallingNumber(options, add, finish);
     }
     
-    this.iccInfo.fdn = [];
+    this.iccInfo.FDN = [];
     this.iccIO({
       command:   ICC_COMMAND_GET_RESPONSE,
       fileId:    ICC_EF_FDN,
       pathId:    EF_PATH_MF_SIM + EF_PATH_DF_TELECOM,
       p1:        0, // For GET_RESPONSE, p1 = 0
       p2:        0, // For GET_RESPONSE, p2 = 0
       p3:        GET_RESPONSE_EF_SIZE_BYTES,
       data:      null,
@@ -1224,34 +1222,34 @@ let RIL = {
    *  @param fileId
    *         EF id of the ADN.
    *  @paran requestId
    *         Request id from RadioInterfaceLayer.
    */
   getADN: function getADN(options) {
     function callback(options) {
       function add(contact) {
-        this.iccInfo.adn.push(contact);
+        this.iccInfo.ADN.push(contact);
       };
       function finish() {
         if (DEBUG) {
-          for (let i = 0; i < this.iccInfo.adn.length; i++) {
-            debug("ADN[" + i + "] alphaId = " + this.iccInfo.adn[i].alphaId +
-                                " number = " + this.iccInfo.adn[i].number);
+          for (let i = 0; i < this.iccInfo.ADN.length; i++) {
+            debug("ADN[" + i + "] alphaId = " + this.iccInfo.ADN[i].alphaId +
+                                " number = " + this.iccInfo.ADN[i].number);
           }
         }
         this.sendDOMMessage({type: "icccontacts",
                              contactType: "ADN",
-                             contacts: this.iccInfo.adn,
+                             contacts: this.iccInfo.ADN,
                              requestId: options.requestId});
       };
       this.parseDiallingNumber(options, add, finish);
     }
 
-    this.iccInfo.adn = [];
+    this.iccInfo.ADN = [];
     this.iccIO({
       command:   ICC_COMMAND_GET_RESPONSE,
       fileId:    options.fileId,
       pathId:    EF_PATH_MF_SIM + EF_PATH_DF_TELECOM,
       p1:        0, // For GET_RESPONSE, p1 = 0
       p2:        0, // For GET_RESPONSE, p2 = 0
       p3:        GET_RESPONSE_EF_SIZE_BYTES,
       data:      null,
@@ -2003,25 +2001,23 @@ let RIL = {
       }
     }
 
     let cell = this.cellLocation;
     let cellChanged = false;
 
     // From TS 23.003, 0000 and 0xfffe are indicated that no valid LAI exists
     // in MS. So we still need to report the '0000' as well.
-    let lac = parseInt(state[1], 16);
-    if (cell.lac !== lac) {
-      cell.lac = lac;
+    if (cell.lac !== state[1]) {
+      cell.lac = state[1];
       cellChanged = true;
     }
 
-    let cid = parseInt(state[2], 16);
-    if (cell.cid !== cid) {
-      cell.cid = cid;
+    if (cell.cid !== state[2]) {
+      cell.cid = state[2];
       cellChanged = true;
     }
 
     if (cellChanged) {
       cell.type = "celllocationchanged";
       this.sendDOMMessage(cell);
     }
 
@@ -2702,17 +2698,17 @@ RIL[REQUEST_DIAL] = function REQUEST_DIA
     return;
   }
 };
 RIL[REQUEST_GET_IMSI] = function REQUEST_GET_IMSI(length, options) {
   if (options.rilRequestError) {
     return;
   }
 
-  this.iccInfo.imsi = Buf.readString();
+  this.iccInfo.IMSI = Buf.readString();
 };
 RIL[REQUEST_HANGUP] = function REQUEST_HANGUP(length, options) {
   if (options.rilRequestError) {
     return;
   }
 
   this.getCurrentCalls();
 };