ANDROID5, security enhancements/dev directory cannot be viewed, and cannot enumerate serial ports
View/dev must first know what type of process your app is running on.
Want to know what your process (APP) belongs to *.te?
View with ps-z: Root@aaaa:/ # ps -z ps -z label User pid ppid name ................ ........ ............... ........ u:r:platform_app:s0 u0_a23 4003 758 Com.android.browser u:r:platform_app:s0 U0_a3 4249 758 com.android.defcontainer U:r:untrusted_ app:s0 u0_a61 4329 758 com.svox.pico u:r:kernel:s0 root 5236 2 kworker/u9 : 0 u:r:untrusted_app:s0 u0_a75 5311 760 com.qihoo.daemon u:r:untrusted_app:s0 u0_a75 5333 760 Com.qihoo.appstore u:r:netdiag:s0 shell 5731 741 /system/bin/ Netdiag u:r:netdiag:s0 shell 5733 5731 sh u:r:netdiag:s0 shell 5734 5733 tcpdump u:r:kernel:s0 root 5746 2 kbase_event u:r:kernel:s0 root 5782 2 kworker/u8:1 u:r:kernel:s0 root 5783 2 kworker/u8:6 u:r:kernel:s0 root 5784 2 kworker/1:0 u:r:kernel:s0 root 5786 2 fs_suspend_syss u:r:kernel:s0 root 5787 2 kworker/u8:7 u:r:kernel:s0 root 5796 2 kworker/u8:8 u:r:kernel:s0 root 5805 2 kworker/u8:9 u:r:platform_app:s0 u0_a30 5835 758 Com.android.deskclock u:r:kernel:s0 root 5858 2 kworker/0:0 U:r:kernel: s0 Root 5894 2 kworker/u9:3 U:r: untrusted_app:s0 u0_a76 5913 760 android_serialport_api.samp le u:r:kernel:s0 root 6014 2 kworker/1:3 u:r:kernel:s0 root 6052&nBsp; 2 kworker/0:1 u:r:kernel:s0 root 6056 2 kworker/u9:2 u:r:su:s0 root 6427 3479 /system/bin/sh u:r:su:s0 root 6433 6427 ps root@aaaaaa:/ # Android_serialport_ Api.sample Process Security Policy untrusted_app This group configuration need to modify untrusted_app.te files
Lookup method Find-name "Untrusted_app.te" >findlog
The location of the MT6735 Untrusted_app.te file is viewed under Alps\device\mediatek\common\sepolicy and Alps\external\sepolicy directory Alps\exter Nal\sepolicy\file_contexts
########################################### # Root # Nothing required since it are INITRAMFS and implicitly # by Genfscon Rootfs in Ocontexts. # ########################## # Devices #/dev (/.*)? u:object_r:device:s0/dev/akm8973.* U:object_r:akm_device:s0/dev/accelerometer U:object_r:accelerometer_device: S0/dev/alarm u:object_r:alarm_device:s0 ........ .......... ...
/dev (/.*)? The U:object_r:device:s0/dev directory belongs to the device user group to open the following two files Alps\device\mediatek\common\sepolicy\untrusted_app.te
Alps\external\sepolicy\untrusted_app.te
Add plus # ACCESS/DEV/MTP_USB at the end. Allow Untrusted_app mtp_device:chr_file rw_file_perms; Allow Untrusted_app tty_device:chr_file rw_file_perms; Allow Untrusted_app serial_device:chr_file rw_file_perms; Allow Untrusted_app Device:dir rw_dir_perms; Allow Untrusted_app ttyacm_device:chr_file rw_file_perms; Allow Untrusted_app ttymt_device:chr_file rw_file_perms; Allow Untrusted_app ttygs_device:chr_file rw_file_perms;
Re-compiling to access the
Open serial port read-write alps\device\mediatek\common\sepolicy\ Untrusted_app.te
Add Plus at end
Allow Untrusted_app ttyacm_device:chr_file rw_file_perms; Allow Untrusted_app ttymt_device:chr_file rw_file_perms; Allow Untrusted_app ttygs_device:chr_file rw_file_perms;