Bug 1167132 - Part 7: [NetworkManager] Move network information into a separate interface (MobileConnection). r=echen
authorJessica Jong <jjong@mozilla.com>
Wed, 22 Jul 2015 19:32:00 -0400
changeset 286949 b6dc4da81f01d44da978b3f9e683e0f0bbfedb99
parent 286948 36009a9b7a4867f3379654df6d9dfe8575f14603
child 286950 b61a73af6333694a3eb7982baf7984cf6d81f300
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersechen
bugs1167132
milestone42.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 1167132 - Part 7: [NetworkManager] Move network information into a separate interface (MobileConnection). r=echen
dom/mobileconnection/gonk/MobileConnectionService.js
dom/system/gonk/DataCallManager.js
--- a/dom/mobileconnection/gonk/MobileConnectionService.js
+++ b/dom/mobileconnection/gonk/MobileConnectionService.js
@@ -703,20 +703,20 @@ MobileConnectionProvider.prototype = {
     if (isUpdated && !aBatch) {
       this.deliverListenerEvent("notifyVoiceChanged");
     }
   },
 
   updateDataInfo: function(aNewInfo, aBatch = false) {
     // For the data connection, the `connected` flag indicates whether
     // there's an active data call. We get correct `connected` state here.
-    let active = gNetworkManager.active;
+    let active = gNetworkManager.activeNetworkInfo;
     aNewInfo.connected = false;
     if (active &&
-        active.type === Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE &&
+        active.type === Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE &&
         active.serviceId === this._clientId) {
       aNewInfo.connected = true;
     }
 
     let isUpdated = this._updateConnectionInfo(this.data, aNewInfo);
     if (isUpdated && !aBatch) {
       this.deliverListenerEvent("notifyDataChanged");
     }
@@ -1594,21 +1594,20 @@ MobileConnectionService.prototype = {
       case NS_NETWORK_ACTIVE_CHANGED_TOPIC_ID:
         for (let i = 0; i < this.numItems; i++) {
           let provider = this._providers[i];
           // Update connected flag only.
           provider.updateDataInfo({});
         }
         break;
       case NS_DATA_CALL_ERROR_TOPIC_ID:
-        let network = aSubject;
         try {
-          if (network instanceof Ci.nsIRilNetworkInterface) {
-            let rilNetwork = network.QueryInterface(Ci.nsIRilNetworkInterface);
-            this.notifyDataError(rilNetwork.serviceId, rilNetwork);
+          if (aSubject instanceof Ci.nsIRilNetworkInfo) {
+            let rilInfo = aSubject.QueryInterface(Ci.nsIRilNetworkInfo);
+            this.notifyDataError(rilInfo.serviceId, aData);
           }
         } catch (e) {}
         break;
       case NS_PREFBRANCH_PREFCHANGE_TOPIC_ID:
         if (aData === kPrefRilDebuggingEnabled) {
           this._updateDebugFlag();
         }
         break;
--- a/dom/system/gonk/DataCallManager.js
+++ b/dom/system/gonk/DataCallManager.js
@@ -833,33 +833,24 @@ DataCallHandler.prototype = {
     }
 
     return -1;
   },
 
   /**
    * Notify about data call setup error, called from DataCall.
    */
-  notifyDataCallError: function(aMessage) {
+  notifyDataCallError: function(aDataCall, aErrorMsg) {
     // Notify data call error only for data APN
     let networkInterface = this.dataNetworkInterfaces.get(NETWORK_TYPE_MOBILE);
     if (networkInterface && networkInterface.enabled) {
       let dataCall = networkInterface.dataCall;
-      // If there is a cid, compare cid; otherwise it is probably an error on
-      // data call setup.
-      if (aMessage.cid !== undefined) {
-        if (aMessage.linkInfo.cid == dataCall.linkInfo.cid) {
-          Services.obs.notifyObservers(networkInterface, TOPIC_DATA_CALL_ERROR,
-                                       null);
-        }
-      } else {
-        if (this._compareDataCallOptions(dataCall, aMessage)) {
-          Services.obs.notifyObservers(networkInterface, TOPIC_DATA_CALL_ERROR,
-                                       null);
-        }
+      if (this._compareDataCallOptions(dataCall, aDataCall)) {
+        Services.obs.notifyObservers(networkInterface.info,
+                                     TOPIC_DATA_CALL_ERROR, aErrorMsg);
       }
     }
   },
 
   /**
    * Notify about data call changed, called from DataCall.
    */
   notifyDataCallChanged: function(aUpdatedDataCall) {
@@ -1062,17 +1053,17 @@ DataCall.prototype = {
       this.state = NETWORK_STATE_DISCONNECTED;
 
       if (this.requestedNetworkIfaces.length === 0) {
         if (DEBUG) this.debug("This DataCall is not requested anymore.");
         return;
       }
 
       // Let DataCallHandler notify MobileConnectionService
-      this.dataCallHandler.notifyDataCallError(this);
+      this.dataCallHandler.notifyDataCallError(this, errorMsg);
 
       // For suggestedRetryTime, the value of INT32_MAX(0x7fffffff) means no retry.
       if (aDataCall.suggestedRetryTime === INT32_MAX ||
           this.isPermanentFail(aDataCall.failCause, errorMsg)) {
         if (DEBUG) this.debug("Data call error: no retry needed.");
         return;
       }