forked from M66B/XPrivacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXInputDevice.java
55 lines (43 loc) · 1.32 KB
/
XInputDevice.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package biz.bokhorst.xprivacy;
import java.util.ArrayList;
import java.util.List;
import android.os.Binder;
public class XInputDevice extends XHook {
private Methods mMethod;
private XInputDevice(Methods method, String restrictionName) {
super(restrictionName, method.name(), "InputDevice." + method.name());
mMethod = method;
}
public String getClassName() {
return "android.view.InputDevice";
}
// @formatter:off
// public String getDescriptor()
// public String getName()
// frameworks/base/core/java/android/view/InputDevice.java
// http://developer.android.com/reference/android/view/InputDevice.html
// @formatter:on
private enum Methods {
getDescriptor, getName
};
public static List<XHook> getInstances() {
List<XHook> listHook = new ArrayList<XHook>();
listHook.add(new XInputDevice(Methods.getDescriptor, PrivacyManager.cIdentification));
listHook.add(new XInputDevice(Methods.getName, PrivacyManager.cIdentification));
return listHook;
}
@Override
protected void before(XParam param) throws Throwable {
switch (mMethod) {
case getDescriptor:
case getName:
if (isRestricted(param))
param.setResult(PrivacyManager.getDefacedProp(Binder.getCallingUid(), "DeviceDescriptor"));
break;
}
}
@Override
protected void after(XParam param) throws Throwable {
// Do nothing
}
}