1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2025-01-01 12:54:07 +00:00

Show NetGuard in the application list again

Fixes #312
This commit is contained in:
M66B 2016-02-12 08:35:37 +01:00
parent 1c86d724de
commit 13bc0e237d
2 changed files with 13 additions and 19 deletions

View file

@ -226,27 +226,25 @@ public class Rule {
if (pre_system.containsKey(info.packageName))
rule.system = pre_system.get(info.packageName);
if (info.applicationInfo.uid == Process.myUid())
rule.system = true;
if (all ||
((rule.system ? show_system : show_user) &&
(show_nointernet || rule.internet) &&
(show_disabled || rule.enabled) &&
info.applicationInfo.uid != Process.myUid())) {
(show_disabled || rule.enabled))) {
// Internet access is needed to resolve host names
if (info.applicationInfo.uid != Process.myUid()) {
rule.wifi_default = (pre_wifi_blocked.containsKey(info.packageName) ? pre_wifi_blocked.get(info.packageName) : default_wifi);
rule.other_default = (pre_other_blocked.containsKey(info.packageName) ? pre_other_blocked.get(info.packageName) : default_other);
rule.screen_wifi_default = default_screen_wifi;
rule.screen_other_default = default_screen_other;
rule.roaming_default = (pre_roaming.containsKey(info.packageName) ? pre_roaming.get(info.packageName) : default_roaming);
rule.wifi_default = (pre_wifi_blocked.containsKey(info.packageName) ? pre_wifi_blocked.get(info.packageName) : default_wifi);
rule.other_default = (pre_other_blocked.containsKey(info.packageName) ? pre_other_blocked.get(info.packageName) : default_other);
rule.screen_wifi_default = default_screen_wifi;
rule.screen_other_default = default_screen_other;
rule.roaming_default = (pre_roaming.containsKey(info.packageName) ? pre_roaming.get(info.packageName) : default_roaming);
rule.wifi_blocked = (!(rule.system && !manage_system) && wifi.getBoolean(info.packageName, rule.wifi_default));
rule.other_blocked = (!(rule.system && !manage_system) && other.getBoolean(info.packageName, rule.other_default));
rule.screen_wifi = screen_wifi.getBoolean(info.packageName, rule.screen_wifi_default);
rule.screen_other = screen_other.getBoolean(info.packageName, rule.screen_other_default);
rule.roaming = roaming.getBoolean(info.packageName, rule.roaming_default);
}
rule.wifi_blocked = (!(rule.system && !manage_system) && wifi.getBoolean(info.packageName, rule.wifi_default));
rule.other_blocked = (!(rule.system && !manage_system) && other.getBoolean(info.packageName, rule.other_default));
rule.screen_wifi = screen_wifi.getBoolean(info.packageName, rule.screen_wifi_default);
rule.screen_other = screen_other.getBoolean(info.packageName, rule.screen_other_default);
rule.roaming = roaming.getBoolean(info.packageName, rule.roaming_default);
List<String> listPkg = new ArrayList<>();
if (pre_related.containsKey(info.packageName))

View file

@ -1189,10 +1189,6 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
private Allowed isAddressAllowed(Packet packet) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
// Allow name resolving
if (packet.uid == Process.myUid())
return new Allowed();
packet.allowed = false;
if (prefs.getBoolean("filter", false)) {
if (packet.uid < 0) // unknown