SElinux avc权限不足问题:
1.编译debug版本.
2.抓log:adb shell --> dmesg | grep avc
3.补充相对应的.te文件;.te文件也可以自己写,要先去system/sepolicy/file_contexts文件下声明;
总体原则就是缺什么权限就补什么权限!!!
比如打印出的错误信息如下:

log分析:
read/write: 表示没有read/write权限;
system_app:system_app中缺少权限,文件名与此相同,xxx.te;
serial_device : serial_device文件系统缺少权限;
chr_file :chr_file类型的文件;
修改方案:
在system_app.te文件中,添加下面语句:
allow system_app serial_device:chr_file read;
allow system_app serial_device:chr_file write;

service名(abc)+_exec结尾。
android的工具 audit2allow生成安全策略
sudo apt-get install policycoreutils
sudo apt-get autoremove # 安装有问题时执行
adb shell dmesg | grep avc > avc_log.txt
audit2allow -i avc_log.txt

执行完结果见上图,其中#============= adpl ==============代表你要添加的te文件,这里我们需要找到adpl.te文件,然后添加
allow adpl diag_device:chr_file { read write };,需要哪个添加那个即可;
报错:
解决方法:
关于编译时遇到neverallow报错问题,可到提示对应脚本处添加相应的权限;
