Bug 946942 - Update APN settings on start if MMS call is already connected. r=gene
authorAnshul Jain <anshulj@codeaurora.org>
Fri, 06 Dec 2013 12:01:30 -0800
changeset 174936 bcdcc7f548bfb91c342d074c41c5011032cd60c9
parent 174935 5aecc00ca4dd90cce91076fe5a061351527bfb69
child 174997 2099f78b7deaa46274cbb90db960629e8fba1a3b
child 175087 60393df0000aa996364b40344c79dda29dcbff64
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgene
bugs946942
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 946942 - Update APN settings on start if MMS call is already connected. r=gene
dom/mobilemessage/src/gonk/MmsService.js
--- a/dom/mobilemessage/src/gonk/MmsService.js
+++ b/dom/mobilemessage/src/gonk/MmsService.js
@@ -243,16 +243,33 @@ MmsConnection.prototype = {
       this.radioDisabled = Services.prefs.getBoolPref(kPrefRilRadioDisabled);
     } catch (e) {
       if (DEBUG) debug("Getting preference 'ril.radio.disabled' fails.");
       this.radioDisabled = false;
     }
 
     this.connected = this.radioInterface.getDataCallStateByType("mms") ==
       Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED;
+    // If the MMS network is connected during the initialization, it means the
+    // MMS network must share the same APN with the mobile network by default.
+    // Under this case, |networkManager.active| should keep the mobile network,
+    // which is supposed be an instance of |nsIRilNetworkInterface| for sure.
+    if (this.connected) {
+      let networkManager =
+        Cc["@mozilla.org/network/manager;1"].getService(Ci.nsINetworkManager);
+      let activeNetwork = networkManager.active;
+      if (activeNetwork.serviceId != this.serviceId) {
+        return;
+      }
+
+      let rilNetwork = activeNetwork.QueryInterface(Ci.nsIRilNetworkInterface);
+      // Set up the MMS APN setting based on the connected MMS network,
+      // which is going to be used for the HTTP requests later.
+      this.setApnSetting(rilNetwork);
+    }
   },
 
   /**
    * Return the roaming status of voice call.
    *
    * @return true if voice call is roaming.
    */
   isVoiceRoaming: function isVoiceRoaming() {