Bug 1052843 - Part 3: Use enums for MobileRadioState in nsIMobileConnectionService.idl (gonk). r=echen

This commit is contained in:
Jessica Jong 2014-10-24 17:12:35 +08:00
Родитель 983b6409cc
Коммит 9e5dc5932b
3 изменённых файлов: 24 добавлений и 22 удалений

Просмотреть файл

@ -379,7 +379,7 @@ MobileConnectionProvider.prototype = {
data: null,
iccId: null,
networkSelectionMode: Ci.nsIMobileConnection.NETWORK_SELECTION_MODE_UNKNOWN,
radioState: null,
radioState: Ci.nsIMobileConnection.MOBILE_RADIO_STATE_UNKNOWN,
lastKnownNetwork: null,
lastKnownHomeNetwork: null,
supportedNetworkTypes: null,
@ -743,7 +743,7 @@ MobileConnectionProvider.prototype = {
},
setPreferredNetworkType: function(aType, aCallback) {
if (this.radioState !== RIL.GECKO_RADIOSTATE_ENABLED) {
if (this.radioState !== Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED) {
this._dispatchNotifyError(aCallback, RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
return;
}
@ -762,7 +762,7 @@ MobileConnectionProvider.prototype = {
},
getPreferredNetworkType: function(aCallback) {
if (this.radioState !== RIL.GECKO_RADIOSTATE_ENABLED) {
if (this.radioState !== Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED) {
this._dispatchNotifyError(aCallback, RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
return;
}
@ -984,7 +984,7 @@ MobileConnectionProvider.prototype = {
return;
}
if (this.radioState !== RIL.GECKO_RADIOSTATE_ENABLED) {
if (this.radioState !== Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED) {
this._dispatchNotifyError(aCallback, RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
return;
}
@ -1003,7 +1003,7 @@ MobileConnectionProvider.prototype = {
},
getCallingLineIdRestriction: function(aCallback) {
if (this.radioState !== RIL.GECKO_RADIOSTATE_ENABLED) {
if (this.radioState !== Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED) {
this._dispatchNotifyError(aCallback, RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
return;
}

Просмотреть файл

@ -504,13 +504,15 @@ XPCOMUtils.defineLazyGetter(this, "gRadioEnabledController", function() {
},
_isValidStateForSetRadioEnabled: function(radioState) {
return radioState == RIL.GECKO_RADIOSTATE_ENABLED ||
radioState == RIL.GECKO_RADIOSTATE_DISABLED;
return radioState == Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED ||
radioState == Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLED;
},
_isDummyForSetRadioEnabled: function(radioState, data) {
return (radioState == RIL.GECKO_RADIOSTATE_ENABLED && data.enabled) ||
(radioState == RIL.GECKO_RADIOSTATE_DISABLED && !data.enabled);
return (radioState == Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED &&
data.enabled) ||
(radioState == Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLED &&
!data.enabled);
},
_handleMessage: function(message) {
@ -573,15 +575,15 @@ XPCOMUtils.defineLazyGetter(this, "gRadioEnabledController", function() {
let radioInterface = _ril.getRadioInterface(clientId);
this.notifyRadioStateChanged(clientId,
enabled ? RIL.GECKO_RADIOSTATE_ENABLING
: RIL.GECKO_RADIOSTATE_DISABLING);
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.
this.notifyRadioStateChanged(clientId,
enabled ? RIL.GECKO_RADIOSTATE_DISABLED
: RIL.GECKO_RADIOSTATE_ENABLED);
enabled ? Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLED
: Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED);
}
message.callback(response);
return false;
@ -1197,7 +1199,7 @@ DataConnectionHandler.prototype = {
// This check avoids data call connection if the radio is not ready
// yet after toggling off airplane mode.
let radioState = connection && connection.radioState;
if (radioState != RIL.GECKO_RADIOSTATE_ENABLED) {
if (radioState != Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED) {
if (DEBUG) {
this.debug("RIL is not ready for data connection: radio's not ready");
}
@ -3525,8 +3527,8 @@ RadioInterface.prototype = {
if (DEBUG) this.debug("Error! Address is invalid when sending SMS: " +
options.number);
errorCode = Ci.nsIMobileMessageCallback.INVALID_ADDRESS_ERROR;
} else if (radioState == null ||
radioState == RIL.GECKO_RADIOSTATE_DISABLED) {
} else if (radioState == Ci.nsIMobileConnection.MOBILE_RADIO_STATE_UNKNOWN ||
radioState == Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLED) {
if (DEBUG) this.debug("Error! Radio is disabled when sending SMS.");
errorCode = Ci.nsIMobileMessageCallback.RADIO_DISABLED_ERROR;
} else if (this.rilContext.cardState != Ci.nsIIccProvider.CARD_STATE_READY) {

Просмотреть файл

@ -2490,12 +2490,12 @@ this.CALL_FAIL_IMSI_UNKNOWN_IN_VLR = 242;
this.CALL_FAIL_IMEI_NOT_ACCEPTED = 243;
this.CALL_FAIL_ERROR_UNSPECIFIED = 0xffff;
// Other Gecko-specific constants
this.GECKO_RADIOSTATE_UNKNOWN = null;
this.GECKO_RADIOSTATE_ENABLING = "enabling";
this.GECKO_RADIOSTATE_ENABLED = "enabled";
this.GECKO_RADIOSTATE_DISABLING = "disabling";
this.GECKO_RADIOSTATE_DISABLED = "disabled";
// See nsIMobileConnection::MOBILE_RADIO_STATE_*
this.GECKO_RADIOSTATE_UNKNOWN = -1;
this.GECKO_RADIOSTATE_ENABLING = 0;
this.GECKO_RADIOSTATE_ENABLED = 1;
this.GECKO_RADIOSTATE_DISABLING = 2;
this.GECKO_RADIOSTATE_DISABLED = 3;
// Only used in ril_worker.js
this.GECKO_CARDSTATE_UNINITIALIZED = 4294967294; // UINT32_MAX - 1