diff --git a/app/src/main/java/eu/faircode/netguard/Rule.java b/app/src/main/java/eu/faircode/netguard/Rule.java index f07445e6..06acf7fa 100644 --- a/app/src/main/java/eu/faircode/netguard/Rule.java +++ b/app/src/main/java/eu/faircode/netguard/Rule.java @@ -125,6 +125,7 @@ public class Rule { Map pre_blocked = new HashMap<>(); Map pre_roaming = new HashMap<>(); Map pre_related = new HashMap<>(); + Map pre_system = new HashMap<>(); try { XmlResourceParser xml = context.getResources().getXml(R.xml.predefined); int eventType = xml.getEventType(); @@ -142,10 +143,16 @@ public class Rule { String pkg = xml.getAttributeValue(null, "package"); String[] rel = xml.getAttributeValue(null, "related").split(","); pre_related.put(pkg, rel); - Log.d(tag, "Relation " + pkg + " related=" + TextUtils.join(",", rel)); + + } else if ("type".equals(xml.getName())) { + String pkg = xml.getAttributeValue(null, "package"); + boolean system = xml.getAttributeBooleanValue(null, "system", true); + pre_system.put(pkg, system); + Log.d(tag, "Type " + pkg + " system=" + system); } + eventType = xml.next(); } } catch (Throwable ex) { @@ -157,6 +164,8 @@ public class Rule { List listRules = new ArrayList<>(); for (PackageInfo info : context.getPackageManager().getInstalledPackages(0)) { Rule rule = new Rule(info, context); + if (pre_system.containsKey(info.packageName)) + rule.system = pre_system.get(info.packageName); if (all || ((rule.system ? show_system : show_user) && (show_nointernet ? true : rule.internet) && diff --git a/app/src/main/res/xml/predefined.xml b/app/src/main/res/xml/predefined.xml index 0435e0b4..79d6487b 100644 --- a/app/src/main/res/xml/predefined.xml +++ b/app/src/main/res/xml/predefined.xml @@ -13,4 +13,10 @@ package="com.android.chrome" related="com.android.providers.downloads" title="Chrome" /> + +