Bug 742797 - Fix shutdown on ICS. r=cjones DONTBUILD

This commit is contained in:
Blake Kaplan 2012-04-05 19:47:08 +02:00
parent 5e3fddb58d
commit 7e14680004
3 changed files with 20 additions and 10 deletions

View File

@ -164,6 +164,10 @@ var WifiManager = (function() {
voidControlMessage("start_supplicant", callback);
}
function terminateSupplicant(callback) {
doBooleanCommand("TERMINATE", "OK", callback);
}
function stopSupplicant(callback) {
voidControlMessage("stop_supplicant", callback);
}
@ -895,15 +899,17 @@ var WifiManager = (function() {
});
});
} else {
stopSupplicant(function (status) {
if (status < 0) {
callback(-1);
return;
}
manager.state = "UNINITIALIZED";
disableInterface(manager.ifname, function (ok) {
unloadDriver(callback);
// Note these following calls ignore errors. If we fail to kill the
// supplicant gracefully, then we need to continue telling it to die
// until it does.
terminateSupplicant(function (ok) {
stopSupplicant(function (status) {
manager.state = "UNINITIALIZED";
closeSupplicantConnection(function () {
disableInterface(manager.ifname, function (ok) {
unloadDriver(callback);
});
});
});
});
}

View File

@ -23,7 +23,7 @@ let libhardware_legacy = (function () {
connect_to_supplicant: library.declare("wifi_connect_to_supplicant", ctypes.default_abi, ctypes.int),
// Close connection to connection to the supplicant, 0 on success, < 0 on failure.
close_supplicant_connection: library.declare("wifi_close_supplicant_connection", ctypes.default_abi, ctypes.int),
close_supplicant_connection: library.declare("wifi_close_supplicant_connection", ctypes.default_abi, ctypes.void_t),
// Block until a wifi event is returned, buf is the buffer, len is the max length of the buffer.
// Return value is number of bytes in buffer, or 0 if no event (no connection for instance), and < 0 on failure.

View File

@ -90,6 +90,10 @@ self.onmessage = function(e) {
var ret = libcutils.property_set(data.key, data.value);
postMessage({ id: id, status: ret });
break;
case "close_supplicant_connection":
libhardware_legacy.close_supplicant_connection();
postMessage({ id: id, status: ret });
break;
default:
var f = libhardware_legacy[cmd] || libnetutils[cmd];
var ret = f();