mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Rename available/unavailable states.
This commit is contained in:
@@ -33,8 +33,8 @@ import static android.os.Build.VERSION.SDK_INT;
|
||||
import static java.util.Collections.emptyList;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import static org.briarproject.bramble.api.plugin.Plugin.State.AVAILABLE;
|
||||
import static org.briarproject.bramble.api.plugin.Plugin.State.UNAVAILABLE;
|
||||
import static org.briarproject.bramble.api.plugin.Plugin.State.ACTIVE;
|
||||
import static org.briarproject.bramble.api.plugin.Plugin.State.INACTIVE;
|
||||
|
||||
@NotNullByDefault
|
||||
class AndroidLanTcpPlugin extends LanTcpPlugin implements EventListener {
|
||||
@@ -133,8 +133,8 @@ class AndroidLanTcpPlugin extends LanTcpPlugin implements EventListener {
|
||||
private void updateConnectionStatus() {
|
||||
connectionStatusExecutor.execute(() -> {
|
||||
State state = getState();
|
||||
if (state != AVAILABLE && state != UNAVAILABLE) return;
|
||||
List<InetAddress> addrs = getUsableLocalInetAddresses();
|
||||
if (state != ACTIVE && state != INACTIVE) return;
|
||||
List<InetAddress> addrs = getLocalInetAddresses();
|
||||
if (addrs.contains(WIFI_AP_ADDRESS)
|
||||
|| addrs.contains(WIFI_DIRECT_AP_ADDRESS)) {
|
||||
LOG.info("Providing wifi hotspot");
|
||||
@@ -143,7 +143,7 @@ class AndroidLanTcpPlugin extends LanTcpPlugin implements EventListener {
|
||||
// make outgoing connections on API 21+ if another network
|
||||
// has internet access
|
||||
socketFactory = SocketFactory.getDefault();
|
||||
if (state == UNAVAILABLE) bind();
|
||||
if (state == INACTIVE) bind();
|
||||
} else if (addrs.isEmpty()) {
|
||||
LOG.info("Not connected to wifi");
|
||||
socketFactory = SocketFactory.getDefault();
|
||||
@@ -151,7 +151,7 @@ class AndroidLanTcpPlugin extends LanTcpPlugin implements EventListener {
|
||||
} else {
|
||||
LOG.info("Connected to wifi");
|
||||
socketFactory = getSocketFactory();
|
||||
if (state == UNAVAILABLE) bind();
|
||||
if (state == INACTIVE) bind();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user