There are a couple of ways to do this;
- If your process is a daemon that is started by init:
First, you will need to modify the ueventd.common.rc file in the android device tree to establish permissions on the device.
Second, you will need to adjust selinux policy to allow your daemon’s context to access the device. Look in the android device tree /selinux/file_contexts to SET a context for the device, then write a policy for your daemon to allow access to the context you create for the device.
- If your process is an ANDROID USER APPLICATION (i.e., it is something.apk that you install):
DO NOT use approach (1) to solve requirement (2) – this would be deemed a “nasty hack” and would not be transportable across devices.