diff --git a/dom/mms/src/ril/MmsService.js b/dom/mms/src/ril/MmsService.js index 743de3fe4ee6..e6443e7c8e24 100644 --- a/dom/mms/src/ril/MmsService.js +++ b/dom/mms/src/ril/MmsService.js @@ -42,6 +42,7 @@ const TIME_TO_RELEASE_MMS_CONNECTION = 30000; const PREF_RETRIEVAL_MODE = 'dom.mms.retrieval_mode'; const RETRIEVAL_MODE_MANUAL = "manual"; const RETRIEVAL_MODE_AUTOMATIC = "automatic"; +const RETRIEVAL_MODE_AUTOMATIC_HOME = "automatic-home"; const RETRIEVAL_MODE_NEVER = "never"; @@ -160,6 +161,17 @@ XPCOMUtils.defineLazyGetter(this, "gMmsConnection", function () { } }, + /** + * Return the roaming status of data connection. + * + * @return true if data connection is roaming. + */ + isDataConnRoaming: function isDataConnRoaming() { + let isRoaming = gRIL.rilContext.data.roaming; + debug("isDataConnRoaming = " + isRoaming); + return isRoaming; + }, + /** * Acquire the MMS network connection. * @@ -1078,7 +1090,10 @@ MmsService.prototype = { retrievalMode = Services.prefs.getCharPref(PREF_RETRIEVAL_MODE); } catch (e) {} - if (RETRIEVAL_MODE_AUTOMATIC !== retrievalMode) { + let isRoaming = gMmsConnection.isDataConnRoaming(); + if ((retrievalMode === RETRIEVAL_MODE_AUTOMATIC_HOME && isRoaming) || + RETRIEVAL_MODE_MANUAL === retrievalMode || + RETRIEVAL_MODE_NEVER === retrievalMode) { let mmsStatus = RETRIEVAL_MODE_NEVER === retrievalMode ? MMS.MMS_PDU_STATUS_REJECTED : MMS.MMS_PDU_STATUS_DEFERRED; @@ -1094,7 +1109,8 @@ MmsService.prototype = { return; } - // For RETRIEVAL_MODE_AUTOMATIC, proceed to retrieve MMS. + // For RETRIEVAL_MODE_AUTOMATIC or RETRIEVAL_MODE_AUTOMATIC_HOME but not + // roaming, proceed to retrieve MMS. this.retrieveMessage(url, (function responseNotify(mmsStatus, retrievedMessage) { debug("retrievedMessage = " + JSON.stringify(retrievedMessage)); diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 91fa150de146..93b56794756c 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -4158,10 +4158,11 @@ pref("dom.placeholder.show_on_focus", true); pref("wap.UAProf.url", ""); pref("wap.UAProf.tagname", "x-wap-profile"); -//Retrieval mode for MMS -//manual: Manual retrieval mode. -//automatic: Automatic retrieval mode. -//never: Never retrieval mode. +// 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.retrievalRetryCount", 3); pref("dom.mms.retrievalRetryInterval", 300000);