Bug 1167132 - Part 7: [NetworkManager] Move network information into a separate interface (MobileConnection). r=echen

This commit is contained in:
Jessica Jong 2015-07-22 19:32:00 -04:00
Родитель 6c109160ec
Коммит a6382e8e7e
2 изменённых файлов: 10 добавлений и 20 удалений

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

@ -708,10 +708,10 @@ MobileConnectionProvider.prototype = {
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;
}
@ -1599,11 +1599,10 @@ MobileConnectionService.prototype = {
}
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;

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

@ -838,23 +838,14 @@ DataCallHandler.prototype = {
/**
* 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);
}
}
},
@ -1067,7 +1058,7 @@ DataCall.prototype = {
}
// 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 ||