Bug 855605 - B2G MMS: Support auto-home in retrieve mode. r=vyang

This commit is contained in:
Chia-hung Tai 2013-04-09 10:30:38 +08:00
parent 0f05f3e929
commit 21aae31454
2 changed files with 23 additions and 6 deletions

View File

@ -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));

View File

@ -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);