treat ethernet as WiFi when checking updates

Its really easy to use USB Ethernet devices with ChromeOS and some Android
devices like Android TV.  ChromeOS now supports Android apps.  Since really
the goal is to avoid metered networks, and ethernet is very rarely metered,
this fits in with the user expectations around the preference.  And if it
doesn't, there are very few people using Ethernet with F-Droid right now,
so whatever harm does happen will affect an extremely limited number of
people.
This commit is contained in:
Hans-Christoph Steiner 2016-11-10 14:28:35 +01:00
parent 6545a26e31
commit e14cb9d16a

View File

@ -294,11 +294,14 @@ public class UpdateService extends IntentService {
return false;
}
if (activeNetwork.getType() != ConnectivityManager.TYPE_WIFI && Preferences.get().isUpdateOnlyOnWifi()) {
Log.i(TAG, "Skipping update - wifi not available");
return false;
int networkType = activeNetwork.getType();
switch (networkType) {
case ConnectivityManager.TYPE_ETHERNET:
case ConnectivityManager.TYPE_WIFI:
return activeNetwork.isConnectedOrConnecting();
default:
return Preferences.get().isUpdateOnlyOnWifi();
}
return activeNetwork.isConnectedOrConnecting();
}
@Override