diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a15e4ba2..e5c528104 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ Changelog **Next release** -* ... +* Use application whitelist for *getPackagesForUid* and *Srv_getPackagesForUid* ([issue](/../../issues/2116)) [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) diff --git a/src/biz/bokhorst/xprivacy/XPackageManager.java b/src/biz/bokhorst/xprivacy/XPackageManager.java index 02b13f94f..95cc84857 100644 --- a/src/biz/bokhorst/xprivacy/XPackageManager.java +++ b/src/biz/bokhorst/xprivacy/XPackageManager.java @@ -202,12 +202,22 @@ protected void after(XParam param) throws Throwable { } break; + case getPackagesForUid: case Srv_getPackagesForUid: if (param.args.length > 0 && param.args[0] instanceof Integer && param.getResult() != null) { int uid = (Integer) param.args[0]; if (uid != Binder.getCallingUid()) - if (isRestrictedExtra(param, Integer.toString(uid))) - param.setResult(null); + if (isRestrictedExtra(param, Integer.toString(uid))) { + List lstResult = new ArrayList(); + if (param.getResult() instanceof String[]) + for (String packageName : (String[]) param.getResult()) + if (isPackageAllowed(uid, packageName)) + lstResult.add(packageName); + if (lstResult.size() == 0) + param.setResult(null); + else + param.setResult(lstResult.toArray(new String[0])); + } } break; @@ -239,15 +249,6 @@ protected void after(XParam param) throws Throwable { param.setResult(filterApplicationInfo((List) param.getResult())); break; - case getPackagesForUid: - if (param.args.length > 0 && param.args[0] instanceof Integer && param.getResult() != null) { - int uid = (Integer) param.args[0]; - if (uid != Binder.getCallingUid()) - if (isRestrictedExtra(param, Integer.toString(uid))) - param.setResult(null); - } - break; - case getPreferredActivities: break;