mirror of https://github.com/M66B/NetGuard.git
Revert Ethernet exception
This commit is contained in:
parent
dc0526951c
commit
14b0aea105
|
@ -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))
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue