mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 03:39:05 +01:00
Don't assume that non-null WifiInfo means we're connected to wifi.
This commit is contained in:
@@ -137,17 +137,10 @@ class AndroidNetworkManager implements NetworkManager, Service {
|
|||||||
WifiManager wm = (WifiManager) app.getSystemService(WIFI_SERVICE);
|
WifiManager wm = (WifiManager) app.getSystemService(WIFI_SERVICE);
|
||||||
if (wm != null) {
|
if (wm != null) {
|
||||||
WifiInfo info = wm.getConnectionInfo();
|
WifiInfo info = wm.getConnectionInfo();
|
||||||
if (info == null) {
|
if (info != null && info.getIpAddress() != 0) {
|
||||||
LOG.info("Not connected to wifi");
|
|
||||||
} else {
|
|
||||||
LOG.info("Connected to wifi");
|
LOG.info("Connected to wifi");
|
||||||
wifi = true;
|
wifi = true;
|
||||||
if (info.getIpAddress() == 0) {
|
ipv6Only = false;
|
||||||
LOG.info("No IPv4 address");
|
|
||||||
} else {
|
|
||||||
LOG.info("Found an IPv4 address");
|
|
||||||
ipv6Only = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new NetworkStatus(connected, wifi, ipv6Only);
|
return new NetworkStatus(connected, wifi, ipv6Only);
|
||||||
|
|||||||
Reference in New Issue
Block a user