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

Commit

Permalink
Fixed restriction USB.getSerialNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
M66B committed Jan 9, 2015
1 parent 0b74e41 commit cd42fac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Changelog
**Next release**

* Prevent accidental application name clicks ([issue](/../../issues/2109))
* Fixed restriction *USB.getSerialNumber*

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)

Expand Down
25 changes: 13 additions & 12 deletions src/biz/bokhorst/xprivacy/XUsbDevice.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.util.List;

import android.os.Binder;
import android.util.Log;
import biz.bokhorst.xprivacy.XHook;

public class XUsbDevice extends XHook {
Expand Down Expand Up @@ -40,25 +39,27 @@ public static List<XHook> getInstances() {

@Override
protected void before(XParam param) throws Throwable {
if (mMethod == Methods.getDeviceId) {
// Do nothing
}

@Override
protected void after(XParam param) throws Throwable {
switch (mMethod) {
case getDeviceId:
if (param.args.length > 0 && param.args[0] instanceof String) {
if (isRestrictedExtra(param, (String) param.args[0]))
param.setResult(0);
} else {
if (isRestricted(param))
param.setResult(0);
}
break;

} else if (mMethod == Methods.getDeviceName) {
if (isRestricted(param))
case getDeviceName:
case getSerialNumber:
if (param.getResult() != null && isRestricted(param))
param.setResult(PrivacyManager.getDefacedProp(Binder.getCallingUid(), "USB"));

} else
Util.log(this, Log.WARN, "Unknown method=" + param.method.getName());
}

@Override
protected void after(XParam param) throws Throwable {
// Do nothing
break;
}
}
}

0 comments on commit cd42fac

Please sign in to comment.