Bug 942218 - Fix isRadioChanging. r=hsinyi
authorSzu-Yu Chen [:aknow] <szchen@mozilla.com>
Tue, 26 Nov 2013 13:58:28 -0500
changeset 157623 912b38085d2db23612e15c537fe71a3aabd0968f
parent 157622 3d937509b0fe6900e718d13354b1af167dac30b6
child 157624 9bb88c5d468a99d07b62f95a89699db1f40725da
push id25717
push userkwierso@gmail.com
push dateWed, 27 Nov 2013 01:34:26 +0000
treeherdermozilla-central@a6a046acc881 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsinyi
bugs942218
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 942218 - Fix isRadioChanging. r=hsinyi
dom/system/gonk/RadioInterfaceLayer.js
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -1608,22 +1608,16 @@ RadioInterface.prototype = {
     }
 
     let status = RIL.CDMA_OTA_PROVISION_STATUS_TO_GECKO[message.status];
 
     gMessageManager.sendMobileConnectionMessage("RIL:OtaStatusChanged",
                                                 this.clientId, status);
   },
 
-  _isRadioChanging: function _isRadioChanging() {
-    let state = this.rilContext.detailedRadioState;
-    return state == RIL.GECKO_DETAILED_RADIOSTATE_ENABLING ||
-      state == RIL.GECKO_DETAILED_RADIOSTATE_DISABLING;
-  },
-
   _convertRadioState: function _converRadioState(state) {
     switch (state) {
       case RIL.GECKO_RADIOSTATE_OFF:
         return RIL.GECKO_DETAILED_RADIOSTATE_DISABLED;
       case RIL.GECKO_RADIOSTATE_READY:
         return RIL.GECKO_DETAILED_RADIOSTATE_ENABLED;
       default:
         return RIL.GECKO_DETAILED_RADIOSTATE_UNKNOWN;
@@ -1853,17 +1847,21 @@ RadioInterface.prototype = {
     if (dataInfo.roaming && !this.dataCallSettings.roamingEnabled) {
       if (DEBUG) this.debug("We're roaming, but data roaming is disabled.");
       return;
     }
     if (wifi_active) {
       if (DEBUG) this.debug("Don't connect data call when Wifi is connected.");
       return;
     }
-    if (this._isRadioChanging()) {
+
+    let detailedRadioState = this.rilContext.detailedRadioState;
+    if (gRadioEnabledController.isDeactivatingDataCalls() ||
+        detailedRadioState == RIL.GECKO_DETAILED_RADIOSTATE_ENABLING ||
+        detailedRadioState == RIL.GECKO_DETAILED_RADIOSTATE_DISABLING) {
       // We're changing the radio power currently, ignore any changes.
       return;
     }
 
     if (DEBUG) this.debug("Data call settings: connect data call.");
     this.setupDataCallByType("default");
   },
 
@@ -2633,28 +2631,25 @@ RadioInterface.prototype = {
         clientId: this.clientId,
         data: response
       });
       return false;
     }).bind(this));
   },
 
   isValidStateForSetRadioEnabled: function() {
-    let state = this.rilContext.radioState;
-
-    return !this._isRadioChanging() &&
-        (state == RIL.GECKO_RADIOSTATE_READY ||
-         state == RIL.GECKO_RADIOSTATE_OFF);
+    let state = this.rilContext.detailedRadioState;
+    return state == RIL.GECKO_DETAILED_RADIOSTATE_ENABLED ||
+      state == RIL.GECKO_DETAILED_RADIOSTATE_DISABLED;
   },
 
   isDummyForSetRadioEnabled: function(message) {
-    let state = this.rilContext.radioState;
-
-    return (state == RIL.GECKO_RADIOSTATE_READY && message.enabled) ||
-        (state == RIL.GECKO_RADIOSTATE_OFF && !message.enabled);
+    let state = this.rilContext.detailedRadioState;
+    return (state == RIL.GECKO_DETAILED_RADIOSTATE_ENABLED && message.enabled) ||
+      (state == RIL.GECKO_DETAILED_RADIOSTATE_DISABLED && !message.enabled);
   },
 
   setRadioEnabledResponse: function(target, message, errorMsg) {
     if (errorMsg) {
       message.errorMsg = errorMsg;
     }
 
     target.sendAsyncMessage("RIL:SetRadioEnabled", {