Bug 905087 - B2G MMS: add integer pref "dom.mms.version". r=gene, a=leo+
authorVicamo Yang <vyang@mozilla.com>
Fri, 23 Aug 2013 18:54:45 +0800
changeset 119953 cb44fea7a502c032ab0fc71a9c98349b30acbdf0
parent 119951 c8a784074f42adb12fdf7d63a3ad5c0b90dad40a
child 119954 54d3febd5d49f9fd141d42ca35c715f77f88b677
push id76
push userryanvm@gmail.com
push dateFri, 23 Aug 2013 18:44:33 +0000
reviewersgene, leo
bugs905087
milestone18.1
Bug 905087 - B2G MMS: add integer pref "dom.mms.version". r=gene, a=leo+
dom/mobilemessage/src/ril/MmsPduHelper.jsm
dom/mobilemessage/src/ril/MmsService.js
dom/mobilemessage/src/ril/mms_consts.js
modules/libpref/src/init/all.js
--- a/dom/mobilemessage/src/ril/MmsPduHelper.jsm
+++ b/dom/mobilemessage/src/ril/MmsPduHelper.jsm
@@ -8,16 +8,26 @@ const {classes: Cc, interfaces: Ci, util
 
 let WSP = {};
 Cu.import("resource://gre/modules/WspPduHelper.jsm", WSP);
 
 Cu.import("resource://gre/modules/mms_consts.js");
 
 let DEBUG; // set to true to see debug messages
 
+this.MMS_VERSION = (function () {
+  Cu.import("resource://gre/modules/Services.jsm");
+
+  try {
+    return Services.prefs.getIntPref("dom.mms.version");
+  } catch(ex) {}
+
+  return MMS_VERSION_1_3;
+})();
+
 this.translatePduErrorToStatus = function translatePduErrorToStatus(error) {
   if (error == MMS_PDU_ERROR_OK) {
     return MMS_PDU_STATUS_RETRIEVED;
   }
 
   if ((error >= MMS_PDU_ERROR_TRANSIENT_FAILURE)
       && (error < MMS_PDU_ERROR_PERMANENT_FAILURE)) {
     return MMS_PDU_STATUS_DEFERRED;
@@ -1694,16 +1704,19 @@ if (DEBUG) {
   debug = function (s) {
     dump("-$- MmsPduHelper: " + s + "\n");
   };
 } else {
   debug = function (s) {};
 }
 
 this.EXPORTED_SYMBOLS = ALL_CONST_SYMBOLS.concat([
+  // Constant values
+  "MMS_VERSION",
+
   // Utility functions
   "translatePduErrorToStatus",
 
   // Decoders
   "BooleanValue",
   "Address",
   "HeaderField",
   "MmsHeader",
--- a/dom/mobilemessage/src/ril/MmsService.js
+++ b/dom/mobilemessage/src/ril/MmsService.js
@@ -1147,16 +1147,22 @@ AcknowledgeTransaction.prototype = {
                                       this.istream, requestCallback);
   }
 };
 
 /**
  * MmsService
  */
 function MmsService() {
+  if (DEBUG) {
+    let macro = (MMS.MMS_VERSION >> 4) & 0x0f;
+    let minor = MMS.MMS_VERSION & 0x0f;
+    debug("Running protocol version: " + macro + "." + minor);
+  }
+
   // TODO: bug 810084 - support application identifier
 }
 MmsService.prototype = {
 
   classID:   RIL_MMSSERVICE_CID,
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIMmsService,
                                          Ci.nsIWapPushApplication]),
   /*
--- a/dom/mobilemessage/src/ril/mms_consts.js
+++ b/dom/mobilemessage/src/ril/mms_consts.js
@@ -24,19 +24,20 @@ this.MMS_PDU_TYPE_MBOX_UPLOAD_CONF = 144
 this.MMS_PDU_TYPE_MBOX_DELETE_REQ = 145;
 this.MMS_PDU_TYPE_MBOX_DELETE_CONF = 146;
 this.MMS_PDU_TYPE_MBOX_DESCR = 147;
 this.MMS_PDU_TYPE_DELETE_REQ = 148;
 this.MMS_PDU_TYPE_DELETE_CONF = 149;
 this.MMS_PDU_TYPE_CANCEL_REQ = 150;
 this.MMS_PDU_TYPE_CANCEL_CONF = 151;
 
-// MMS version 1.3
+// MMS version
 // @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.34
-this.MMS_VERSION = (0x01 << 4) | 0x03;
+this.MMS_VERSION_1_1 = (0x01 << 4) | 0x01;
+this.MMS_VERSION_1_3 = (0x01 << 4) | 0x03;
 
 // Common Status Values
 this.MMS_PDU_ERROR_OK                = 128;
 this.MMS_PDU_ERROR_TRANSIENT_FAILURE = 192;
 this.MMS_PDU_ERROR_PERMANENT_FAILURE = 224;
 
 // X-Mms-Response-Status values
 // @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.48
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -3884,16 +3884,21 @@ pref("jsloader.reuseGlobal", false);
 // When we're asked to take a screenshot, don't wait more than 2000ms for the
 // event loop to become idle before actually taking the screenshot.
 pref("dom.browserElement.maxScreenshotDelayMS", 2000);
 
 // UAProfile settings
 pref("wap.UAProf.url", "");
 pref("wap.UAProf.tagname", "x-wap-profile");
 
+// MMS version 1.1 = 0x11 (or decimal 17)
+// MMS version 1.3 = 0x13 (or decimal 19)
+// @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.34
+pref("dom.mms.version", 19);
+
 // Retrieval mode for MMS
 // manual: Manual retrieval mode.
 // automatic: Automatic retrieval mode even in roaming.
 // automatic-home: Automatic retrieval mode in home network.
 // never: Never retrieval mode.
 pref("dom.mms.retrieval_mode", "manual");
 
 pref("dom.mms.sendRetryCount", 3);