Bug 1051660 - 0001. Fix minor bugs in API implementation. r=hchang

This commit is contained in:
Chuck Lee 2014-08-18 15:10:24 +08:00
Родитель a94fb4b045
Коммит 8d8c2f503e
1 изменённых файлов: 10 добавлений и 6 удалений

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

@ -2898,24 +2898,28 @@ WifiWorker.prototype = {
// No change.
if (enabled === WifiManager.enabled) {
this._sendMessage(message, true, true, msg);
return;
}
// Can't enable wifi while hotspot mode is enabled.
if (enabled && (this.tetheringSettings[SETTINGS_WIFI_TETHERING_ENABLED] ||
WifiManager.isWifiTetheringEnabled(WifiManager.tetheringState))) {
self._sendMessage(message, false, "Can't enable Wifi while hotspot mode is enabled", msg);
}
// Reply error to pending requests.
if (!enabled) {
this._clearPendingRequest();
return;
}
WifiManager.setWifiEnabled(enabled, function(ok) {
if (ok === 0 || ok === "no change") {
self._sendMessage(message, true, true, msg);
// Reply error to pending requests.
if (!enabled) {
self._clearPendingRequest();
} else {
WifiManager.start();
}
} else {
self._sendMessage(message, false, "Set power saving mode failed", msg);
self._sendMessage(message, false, "Set wifi enabled failed", msg);
}
});
},