Bug 956322 - Trying to download an MMS fails with 'Missing SIM card'. r=vicamo, a=1.3+
authorGene Lian <clian@mozilla.com>
Wed, 08 Jan 2014 11:29:40 +0800
changeset 174643 6154327ecec00eb44ae574e7c552981cbce7883c
parent 174642 35219c188d424999d50b81a055384c9bcd564f45
child 174644 031315f1fe0ba46a44769d21b24df7167e3876a2
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvicamo, 1
bugs956322
milestone28.0a2
Bug 956322 - Trying to download an MMS fails with 'Missing SIM card'. r=vicamo, a=1.3+
dom/mobilemessage/src/gonk/MmsService.js
--- a/dom/mobilemessage/src/gonk/MmsService.js
+++ b/dom/mobilemessage/src/gonk/MmsService.js
@@ -2263,17 +2263,27 @@ MmsService.prototype = {
           return;
         }
       }
 
       // Get the RIL service ID based on the saved MMS message record's ICC ID,
       // which could fail when the corresponding SIM card isn't installed.
       let serviceId;
       try {
-        serviceId = gRil.getClientIdByIccId(aMessageRecord.iccId);
+        if (aMessageRecord.iccId == null) {
+          // If the ICC ID isn't available, it means the MMS has been received
+          // during the previous version that didn't take the DSDS scenario
+          // into consideration. Tentatively, setting the service ID to be 0 by
+          // default is better than nothing. Although it might use the wrong
+          // SIM to download the desired MMS, eventually it would still fail to
+          // download due to the wrong MMSC and proxy settings.
+          serviceId = 0;
+        } else {
+          serviceId = gRil.getClientIdByIccId(aMessageRecord.iccId);
+        }
       } catch (e) {
         if (DEBUG) debug("RIL service is not available for ICC ID.");
         aRequest.notifyGetMessageFailed(Ci.nsIMobileMessageCallback.NO_SIM_CARD_ERROR);
         return;
       }
 
       // To support DSDS, we have to stop users retrieving MMS when the needed
       // SIM is not active, thus avoiding the data disconnection of the current
@@ -2401,17 +2411,27 @@ MmsService.prototype = {
       debug("messageID: " + messageID + " toAddress: " +
             JSON.stringify(toAddress));
     }
 
     // Get the RIL service ID based on the saved MMS message record's ICC ID,
     // which could fail when the corresponding SIM card isn't installed.
     let serviceId;
     try {
-      serviceId = gRil.getClientIdByIccId(iccId);
+      if (iccId == null) {
+        // If the ICC ID isn't available, it means the MMS has been received
+        // during the previous version that didn't take the DSDS scenario
+        // into consideration. Tentatively, setting the service ID to be 0 by
+        // default is better than nothing. Although it might use the wrong
+        // SIM to send the read report for the desired MMS, eventually it
+        // would still fail to send due to the wrong MMSC and proxy settings.
+        serviceId = 0;
+      } else {
+        serviceId = gRil.getClientIdByIccId(iccId);
+      }
     } catch (e) {
       if (DEBUG) debug("RIL service is not available for ICC ID.");
       return;
     }
 
     let mmsConnection = gMmsConnections.getConnByServiceId(serviceId);
     try {
       let transaction =