Bug 1061380 - Part 1: Only access EF_SDN when SDN service is available. r=vicamo, a=bajaj
authorEdgar Chen <echen@mozilla.com>
Wed, 10 Sep 2014 16:29:46 +0800
changeset 225438 f774ac47264124ed6ed7aff7e0f0f7c6472b57a6
parent 225437 da372ef9b8efa1ca5d0edc17f1c43c7185e20da1
child 225439 d5fcddc6091b74d2fb7449b46abdbb6041bcfa36
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvicamo, bajaj
bugs1061380
milestone34.0a2
Bug 1061380 - Part 1: Only access EF_SDN when SDN service is available. r=vicamo, a=bajaj
dom/system/gonk/ril_consts.js
dom/system/gonk/ril_worker.js
dom/system/gonk/tests/test_ril_worker_icc_ICCContactHelper.js
--- a/dom/system/gonk/ril_consts.js
+++ b/dom/system/gonk/ril_consts.js
@@ -1246,21 +1246,22 @@ this.STK_SUPPORTED_TERMINAL_PROFILE = [
   0x00, // 16, Screen effects
   0x00, // 17, BIP supported transport interface
   0x00, // 18, RFU
   0x00, // 19, RFU
   0x00, // 20, RFU
 ];
 
 /**
- * (U)SIM Services.
+ * ICC Services Table.
  *
  * @see 3GPP TS 51.011 10.3.7 (SIM) and 3GPP TS 31.102 4.2.8 (USIM).
  */
 this.GECKO_ICC_SERVICES = {
+  // @see 3GPP TS 51.011 10.3.7 (SIM).
   sim: {
     ADN: 2,
     FDN: 3,
     PLMNSEL: 7,
     MSISDN: 9,
     CBMI: 14,
     GID1: 15,
     SPN: 17,
@@ -1271,16 +1272,17 @@ this.GECKO_ICC_SERVICES = {
     BDN: 31,
     IMG: 39,
     PNN: 51,
     OPL: 52,
     MDN: 53,
     MWIS: 54,
     SPDI: 56
   },
+  // @see 3GPP TS 31.102 4.2.8 (USIM).
   usim: {
     FDN: 2,
     SDN: 4,
     BDN: 6,
     CBMI: 15,
     CBMIR: 16,
     GID1: 17,
     SPN: 19,
@@ -1289,19 +1291,21 @@ this.GECKO_ICC_SERVICES = {
     DATA_DOWNLOAD_SMS_PP: 28,
     DATA_DOWNLOAD_SMS_CB: 29,
     PNN: 45,
     OPL: 46,
     MDN: 47,
     MWIS: 48,
     SPDI: 51
   },
+  // @see 3GPP2 C.S0023-D 3.4.18 (RUIM).
   ruim: {
     ENHANCED_PHONEBOOK: 6,
-    SPN: 17
+    SPN: 17,
+    SDN: 18
   }
 };
 
 /**
  * Cell Broadcast constants
  */
 
 this.CB_FORMAT_GSM  = 0;
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -15167,16 +15167,22 @@ ICCContactHelperObject.prototype = {
         } else {
           this.readUSimContacts(onsuccess, onerror);
         }
         break;
       case "fdn":
         ICCRecordHelper.readADNLike(ICC_EF_FDN, onsuccess, onerror);
         break;
       case "sdn":
+        let ICCUtilsHelper = this.context.ICCUtilsHelper;
+        if (!ICCUtilsHelper.isICCServiceAvailable("SDN")) {
+          onerror(CONTACT_ERR_CONTACT_TYPE_NOT_SUPPORTED);
+          break;
+        }
+
         ICCRecordHelper.readADNLike(ICC_EF_SDN, onsuccess, onerror);
         break;
       default:
         if (DEBUG) {
           this.context.debug("Unsupported contactType :" + contactType);
         }
         onerror(CONTACT_ERR_CONTACT_TYPE_NOT_SUPPORTED);
         break;
--- a/dom/system/gonk/tests/test_ril_worker_icc_ICCContactHelper.js
+++ b/dom/system/gonk/tests/test_ril_worker_icc_ICCContactHelper.js
@@ -22,17 +22,17 @@ add_test(function test_error_message_rea
     ril.readICCContacts(options);
   }
 
   // Error 1, didn't specify correct contactType.
   do_test({}, CONTACT_ERR_REQUEST_NOT_SUPPORTED);
 
   // Error 2, specifying a non-supported contactType.
   ril.appType = CARD_APPTYPE_USIM;
-  do_test({contactType: "sdn"}, CONTACT_ERR_CONTACT_TYPE_NOT_SUPPORTED);
+  do_test({contactType: "foo"}, CONTACT_ERR_CONTACT_TYPE_NOT_SUPPORTED);
 
   // Error 3, suppose we update the supported PBR fields in USIM_PBR_FIELDS,
   // but forget to add implemenetations for it.
   USIM_PBR_FIELDS.push("pbc");
   do_test({contactType: "adn"}, CONTACT_ERR_FIELD_NOT_SUPPORTED);
 
   run_next_test();
 });