Bug 1019358 - 1/2: [dolphin] unable to activate PDP for some specific SIM. r=vicamo
authorming.li <ming.li@spreadtrum.com>
Thu, 05 Jun 2014 14:27:27 +0800
changeset 206004 c6bf6c65c913bf4a7d567610ea415c25d523d064
parent 206003 dfeac9b450c2f55d4d978e4a6ea27a5b6e7fdd20
child 206005 1edaadcd7e6a7701e28d44ff18158327e05f0637
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvicamo
bugs1019358
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1019358 - 1/2: [dolphin] unable to activate PDP for some specific SIM. r=vicamo follow spec TS 31.102 4.2.18 EFAD and check mncLength
dom/system/gonk/ril_worker.js
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -12786,19 +12786,27 @@ SimRecordHelperObject.prototype = {
         for (let i = 0; i < ad.length; i++) {
           str += ad[i] + ", ";
         }
         this.context.debug("AD: " + str);
       }
 
       let ICCUtilsHelper = this.context.ICCUtilsHelper;
       let RIL = this.context.RIL;
+      // TS 31.102, clause 4.2.18 EFAD
+      let mncLength = 0;
+      if (ad && ad[3]) {
+        mncLength = ad[3] & 0x0f;
+        if (mncLength != 0x02 && mncLength != 0x03) {
+           mncLength = 0;
+        }
+      }
       // The 4th byte of the response is the length of MNC.
       let mccMnc = ICCUtilsHelper.parseMccMncFromImsi(RIL.iccInfoPrivate.imsi,
-                                                      ad && ad[3]);
+                                                      mncLength);
       if (mccMnc) {
         RIL.iccInfo.mcc = mccMnc.mcc;
         RIL.iccInfo.mnc = mccMnc.mnc;
         ICCUtilsHelper.handleICCInfoChange();
       }
     }
 
     this.context.ICCIOHelper.loadTransparentEF({
@@ -14125,16 +14133,17 @@ ICCUtilsHelperObject.prototype = {
   /**
    * Parse MCC/MNC from IMSI. If there is no available value for the length of
    * mnc, it will use the data in MCC table to parse.
    *
    * @param imsi
    *        The imsi of icc.
    * @param mncLength [optional]
    *        The length of mnc.
+   *        Zero indicates we haven't got a valid mnc length.
    *
    * @return An object contains the parsing result of mcc and mnc.
    *         Or null if any error occurred.
    */
   parseMccMncFromImsi: function(imsi, mncLength) {
     if (!imsi) {
       return null;
     }