Bug 818830 - B2G 3G: If we change APN name when data call is active, new data call cannot be established. r=vicamo
authorShian-Yow Wu <swu@mozilla.com>
Fri, 14 Dec 2012 11:13:31 +0800
changeset 125130 f752f9d2563112b93940247dcec848035ae1fb78
parent 125129 0fb9ff76a1778ee3fbd57e9f3e6d8e0ce28d4587
child 125131 babbf864b10cdc15338cfead5ef2c61026113873
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvicamo
bugs818830
milestone20.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 818830 - B2G 3G: If we change APN name when data call is active, new data call cannot be established. r=vicamo
dom/system/gonk/RadioInterfaceLayer.js
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -2646,17 +2646,25 @@ RILNetworkInterface.prototype = {
     if (message.apn != this.dataCallSettings["apn"]) {
       return;
     }
     debug("Data call error on APN: " + message.apn);
     this.reset();
   },
 
   dataCallStateChanged: function dataCallStateChanged(datacall) {
-    if (datacall.apn != this.dataCallSettings["apn"]) {
+    if (this.cid && this.cid != datacall.cid) {
+    // If data call for this connection existed but cid mismatched,
+    // it means this datacall state change is not for us.
+      return;
+    }
+    // If data call for this connection does not exist, it could be state
+    // change for new data call.  We only update data call state change
+    // if APN name matched.
+    if (!this.cid && datacall.apn != this.dataCallSettings["apn"]) {
       return;
     }
     debug("Data call ID: " + datacall.cid + ", interface name: " +
           datacall.ifname + ", APN name: " + datacall.apn);
     if (this.connecting &&
         (datacall.state == RIL.GECKO_NETWORK_STATE_CONNECTING ||
          datacall.state == RIL.GECKO_NETWORK_STATE_CONNECTED)) {
       this.connecting = false;
@@ -2670,17 +2678,20 @@ RILNetworkInterface.prototype = {
         this.dns1 = datacall.dns[0];
         this.dns2 = datacall.dns[1];
       }
       if (!this.registeredAsNetworkInterface) {
         gNetworkManager.registerNetworkInterface(this);
         this.registeredAsNetworkInterface = true;
       }
     }
-    if (this.cid != datacall.cid) {
+    // In current design, we don't update status of secondary APN if it shares
+    // same APN name with the default APN.  In this condition, this.cid will
+    // not be set and we don't want to update its status.
+    if (this.cid == null) {
       return;
     }
     if (this.state == datacall.state) {
       return;
     }
 
     this.state = datacall.state;
 
@@ -2690,16 +2701,17 @@ RILNetworkInterface.prototype = {
     if (this == this.mRIL.dataNetworkInterface) {
       this.mRIL.updateRILNetworkInterface();
     }
 
     if (this.state == RIL.GECKO_NETWORK_STATE_UNKNOWN &&
        this.registeredAsNetworkInterface) {
       gNetworkManager.unregisterNetworkInterface(this);
       this.registeredAsNetworkInterface = false;
+      this.cid = null;
       return;
     }
 
     Services.obs.notifyObservers(this,
                                  kNetworkInterfaceStateChangedTopic,
                                  null);
   },