зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1067629
- Part 2: Remove some radio state checks(RadioInterfaceLayer.js). r=aknow
This commit is contained in:
Родитель
c8fc386c7f
Коммит
57be47e7e4
|
@ -482,18 +482,6 @@ XPCOMUtils.defineLazyGetter(this, "gRadioEnabledController", function() {
|
|||
return false;
|
||||
},
|
||||
|
||||
_isValidStateForSetRadioEnabled: function(radioState) {
|
||||
return radioState == Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED ||
|
||||
radioState == Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLED;
|
||||
},
|
||||
|
||||
_isDummyForSetRadioEnabled: function(radioState, data) {
|
||||
return (radioState == Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED &&
|
||||
data.enabled) ||
|
||||
(radioState == Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLED &&
|
||||
!data.enabled);
|
||||
},
|
||||
|
||||
_handleMessage: function(message) {
|
||||
if (DEBUG) debug("RadioControl: handleMessage: " + JSON.stringify(message));
|
||||
let clientId = message.clientId || 0;
|
||||
|
@ -501,19 +489,6 @@ XPCOMUtils.defineLazyGetter(this, "gRadioEnabledController", function() {
|
|||
gMobileConnectionService.getItemByServiceId(clientId);
|
||||
let radioState = connection && connection.radioState;
|
||||
|
||||
if (!this._isValidStateForSetRadioEnabled(radioState)) {
|
||||
message.data.errorMsg = "InvalidStateError";
|
||||
message.callback(message.data);
|
||||
this._processNextMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._isDummyForSetRadioEnabled(radioState, message.data)) {
|
||||
message.callback(message.data);
|
||||
this._processNextMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.data.enabled) {
|
||||
if (this._isRadioAbleToEnableAtClient(clientId)) {
|
||||
this._setRadioEnabledInternal(message);
|
||||
|
@ -563,19 +538,15 @@ XPCOMUtils.defineLazyGetter(this, "gRadioEnabledController", function() {
|
|||
let enabled = message.data.enabled || false;
|
||||
let radioInterface = _ril.getRadioInterface(clientId);
|
||||
|
||||
this.notifyRadioStateChanged(clientId,
|
||||
enabled ? Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLING
|
||||
: Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLING);
|
||||
radioInterface.workerMessenger.send("setRadioEnabled", message.data,
|
||||
(function(response) {
|
||||
if (response.errorMsg) {
|
||||
// Request fails. Rollback to the original radioState.
|
||||
// If request fails, set current radio state to unknown, since we will
|
||||
// handle it in |mobileConnectionService|.
|
||||
this.notifyRadioStateChanged(clientId,
|
||||
enabled ? Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLED
|
||||
: Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED);
|
||||
Ci.nsIMobileConnection.MOBILE_RADIO_STATE_UNKNOWN);
|
||||
}
|
||||
message.callback(response);
|
||||
return false;
|
||||
return message.callback(response);
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче