Fix wifi configuration for nl80211

With nl80211 drivers, the network type is kept even when the network
interface is down, so the adhoc configuration test fails. Therefore, we
need to check the network state before.

Unfortunately, it needs an android-9 feature. But this is not a huge
problem: minSdkVersion is still 8, and devices with android-8 probably
don't use nl80211.

See:
https://groups.google.com/d/msg/serval-project-developers/JGN00i00nFk/AsDRQzWHVI0J