guardianproject / orbot

The Github home of Orbot: Tor on Android (Also available on gitlab!)
https://gitlab.com/guardianproject/orbot
Other
2.13k stars 332 forks source link

Snowflake Proxy Limiting is Misleading/Doesn't Work #548

Open bitmold opened 2 years ago

bitmold commented 2 years ago

By default there is a setting for using your device as a snowflake that's enabled called "Snowflake Proxy Limits". It reads "Only when device is plugged in and on wifi".

In OrbotService:

  public static boolean isChargingAndWifi(Context context) {
        Intent intent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
        int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
        boolean isCharging = plugged == BatteryManager.BATTERY_PLUGGED_AC || plugged == BatteryManager.BATTERY_PLUGGED_USB || plugged == BatteryManager.BATTERY_PLUGGED_WIRELESS;

        ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);

        boolean isUnmetered = cm.getActiveNetworkInfo() != null
                && cm.getActiveNetworkInfo().isConnected()
                && (!cm.isActiveNetworkMetered());

        return isCharging && isUnmetered;
    }

There are several things wrong with this appraoch:

What probably needs to happen:

bitmold commented 2 years ago

For the upcoming release this limiting feature is disabled ...