As the other poster mentioned, the driver and firmware can be closed source. The rest of the Android WiFi stack is very liberally licensed. The Android Java portion is apache and the supplicant is BSD. You can do a lot to tune the stack without sending code upstream.