summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2021-11-08 00:54:24 +0100
committercyBerta <cyberta@riseup.net>2021-11-08 00:54:24 +0100
commit0b80fad26c91e5aa0faf8bc0132184eeeb7883b0 (patch)
tree7e11500369176c54a122f11e857840f9c65cc379 /app/src/main
parent62c28b219a85aa3074356e1e49e92e30c1166c3b (diff)
revert restriction to be connected to wifi in order to use snowflake/tor fallback
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java26
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java5
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java4
3 files changed, 1 insertions, 34 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java b/app/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java
index cbb58f0f..a4f09806 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/NetworkUtils.java
@@ -80,30 +80,4 @@ public class NetworkUtils {
}
return nets;
}
-
- public static boolean isConnectedToWifi(Context context) {
- ConnectivityManager connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
- NetworkInfo wifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
- Log.d(TAG, "isConnectedToWifi (<=LOLLIPOP_MR1): " + wifi.isConnected());
- return wifi.isConnected();
- } else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.O_MR1) {
- NetworkInfo[] netInfos = connManager.getAllNetworkInfo();
- for (NetworkInfo netInfo : netInfos) {
- if (netInfo != null && netInfo.getType() == ConnectivityManager.TYPE_WIFI) {
- Log.d(TAG, "isConnectedToWifi (<= Build.VERSION_CODES.O_MR1): " + netInfo.isConnected());
- return netInfo.isConnected();
- }
- }
- } else {
- NetworkInfo netInfo = connManager.getActiveNetworkInfo();
- if(netInfo != null) {
- NetworkCapabilities networkCapabilities = connManager.getNetworkCapabilities(connManager.getActiveNetwork());
- Log.d(TAG, "isConnectedToWifi (> Build.VERSION_CODES.O_MR1): " + networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI));
- return networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI);
- }
- }
-
- return false;
- }
} \ No newline at end of file
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java
index 335d70b2..c45d7ae9 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java
@@ -155,11 +155,6 @@ public class ProviderAPI extends JobIntentService implements ProviderApiManagerB
}
@Override
- public boolean isConnectedToWifi() {
- return NetworkUtils.isConnectedToWifi(getApplicationContext());
- }
-
- @Override
public void startTorService() throws InterruptedException, IllegalStateException {
initTorServiceConnection(this);
Intent torServiceIntent = new Intent(this, TorService.class);
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java
index 0c09aec1..7872fb32 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java
@@ -153,7 +153,6 @@ public abstract class ProviderApiManagerBase {
void startTorService() throws InterruptedException, IllegalStateException;
void stopTorService();
int getTorHttpTunnelPort();
- boolean isConnectedToWifi();
}
private final ProviderApiServiceCallback serviceCallback;
@@ -305,8 +304,7 @@ public abstract class ProviderApiManagerBase {
protected boolean startTorProxy() throws InterruptedException, IllegalStateException, TimeoutException {
if (EipStatus.getInstance().isDisconnected() &&
- PreferenceHelper.getUseTor(preferences) &&
- serviceCallback.isConnectedToWifi()
+ PreferenceHelper.getUseTor(preferences)
) {
serviceCallback.startTorService();
waitForTorCircuits();