From 2187aa646be860ce801372f142c16b7b85ed65d2 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 1 Jun 2019 16:37:38 +0200 Subject: [PATCH] Made hard coded packages user aware --- app/src/main/java/eu/faircode/netguard/Rule.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/netguard/Rule.java b/app/src/main/java/eu/faircode/netguard/Rule.java index 2dc99cad..5600af26 100644 --- a/app/src/main/java/eu/faircode/netguard/Rule.java +++ b/app/src/main/java/eu/faircode/netguard/Rule.java @@ -273,6 +273,8 @@ public class Rule { List listRules = new ArrayList<>(); List listPI = getPackages(context); + int userId = Process.myUid() / 100000; + // Add root PackageInfo root = new PackageInfo(); root.packageName = "root"; @@ -289,7 +291,7 @@ public class Rule { media.versionCode = Build.VERSION.SDK_INT; media.versionName = Build.VERSION.RELEASE; media.applicationInfo = new ApplicationInfo(); - media.applicationInfo.uid = 1013; + media.applicationInfo.uid = 1013 + userId * 100000; media.applicationInfo.icon = 0; listPI.add(media); @@ -299,7 +301,7 @@ public class Rule { mdr.versionCode = Build.VERSION.SDK_INT; mdr.versionName = Build.VERSION.RELEASE; mdr.applicationInfo = new ApplicationInfo(); - mdr.applicationInfo.uid = 1020; + mdr.applicationInfo.uid = 1020 + userId * 100000; mdr.applicationInfo.icon = 0; listPI.add(mdr); @@ -309,7 +311,7 @@ public class Rule { gps.versionCode = Build.VERSION.SDK_INT; gps.versionName = Build.VERSION.RELEASE; gps.applicationInfo = new ApplicationInfo(); - gps.applicationInfo.uid = 1021; + gps.applicationInfo.uid = 1021 + userId * 100000; gps.applicationInfo.icon = 0; listPI.add(gps); @@ -319,7 +321,7 @@ public class Rule { dns.versionCode = Build.VERSION.SDK_INT; dns.versionName = Build.VERSION.RELEASE; dns.applicationInfo = new ApplicationInfo(); - dns.applicationInfo.uid = 1051; + dns.applicationInfo.uid = 1051 + userId * 100000; dns.applicationInfo.icon = 0; listPI.add(dns);