Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Use application whitelist for (Srv_)getPackagesForUid
Browse files Browse the repository at this point in the history
Closes #2116
  • Loading branch information
M66B committed Feb 12, 2015
1 parent 307b70e commit 6759b52
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
23 changes: 12 additions & 11 deletions src/biz/bokhorst/xprivacy/XPackageManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> lstResult = new ArrayList<String>();
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;

Expand Down Expand Up @@ -239,15 +249,6 @@ protected void after(XParam param) throws Throwable {
param.setResult(filterApplicationInfo((List<ApplicationInfo>) 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;

Expand Down

0 comments on commit 6759b52

Please sign in to comment.