1、添加dev设备定义
device/qcom/sepolicy/common/device.te
type neo_gpio_dev, dev_type;
2、修改设备节点权限
在文件device/qcom/common/rootdir/etc/ueventd.qcom.rc中修改:
/dev/neo_gpio_dev 0660 radio radio
修改->
/dev/neo_gpio_dev 777 system system
3、系统APK权限添加
device/qcom/sepolicy/common/system_app.te 文件中添加:
allow system_app neo_gpio_dev:chr_filerw_file_perms;
device/qcom/sepolicy/common/platform_app.te 文件添加:
allow system_server neo_gpio_dev:chr_file rw_file_perms;
device/qcom/sepolicy/common/untrusted_app.te文件中添加(系统目录app): |
allow untrusted_app neo_gpio_dev:chr_file {read write rw_file_perms}; | 查看你的apk存放
device/qcom/sepolicy/common/priv_app.te(priv目录app): | 目录来添加权限
allow untrusted_app neo_gpio_dev:chr_file {read write rw_file_perms}; |
4、安全上下文权限添加
device/qcom/sepolicy/common/file_contexts:
/dev/neo_gpio_dev u:object_r:neo_gpio_dev:s0
5、系统服务进程允许访问权限添加
device/qcom/sepolicy/common/system_server.te
allow system_server neo_gpio_dev:chr_file rw_file_perms;