Revert Ethernet exception

This commit is contained in:
M66B 2015-11-13 11:05:10 +01:00
parent dc0526951c
commit 14b0aea105
3 changed files with 6 additions and 8 deletions

View File

@ -390,7 +390,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
ivNetwork.setVisibility(View.VISIBLE);
ivMetered.setVisibility(View.VISIBLE);
if (Util.isLocalNetwork(context))
if (Util.isWifiActive(context))
ivNetwork.setImageLevel(1);
else {
if (Util.isRoaming(context))

View File

@ -141,10 +141,10 @@ public class SinkholeService extends VpnService {
Log.i(TAG, "Starting");
// Check state
boolean local = Util.isLocalNetwork(this);
boolean wifi = Util.isWifiActive(this);
boolean metered = Util.isMeteredNetwork(this);
boolean interactive = Util.isInteractive(this);
Log.i(TAG, "local=" + local +
Log.i(TAG, "wifi=" + wifi +
" metered=" + metered +
" roaming=" + last_roaming +
" interactive=" + interactive);
@ -304,8 +304,7 @@ public class SinkholeService extends VpnService {
Log.i(TAG, "New state roaming=" + last_roaming);
reload(null, SinkholeService.this);
} else if (networkType == ConnectivityManager.TYPE_WIFI ||
networkType == ConnectivityManager.TYPE_ETHERNET) {
} else if (networkType == ConnectivityManager.TYPE_WIFI) {
// Local network connected/disconnected
reload(null, SinkholeService.this);
}

View File

@ -60,11 +60,10 @@ public class Util {
return tm.isNetworkRoaming();
}
public static boolean isLocalNetwork(Context context) {
public static boolean isWifiActive(Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = cm.getActiveNetworkInfo();
return (ni != null && (ni.getType() == ConnectivityManager.TYPE_WIFI || ni.getType() == ConnectivityManager.TYPE_ETHERNET));
return (ni != null && ni.getType() == ConnectivityManager.TYPE_WIFI);
}
public static boolean isMeteredNetwork(Context context) {