Android APK 中启动特定的 bin 服务

来源:互联网 发布:有关于大数据的书吗 编辑:程序博客网 时间:2024/04/27 04:55
原文出处:http://blog.csdn.net/jiuxiaoyunwu/article/details/51220477
首先参考资料: http://www.2cto.com/kf/201412/363630.html

    日前工作中遇到一个需求:要求在启动App时,启动对应的bin 服务,从而使得实现APK作为Client端,而bin 服务作为 Server端 实现两者socket通信。

    首先bin 服务文件是由同事A君负责用C语言编写实现,完成后编译到Android手机的system/bin 目录下,名称为:cloudtestsuited ;

    至于APK则是由本人负责编写实现,利用socket实现两者的通信。

    为了实现打开apk即打开了对应的bin服务,故需要实现在apk中启动bin服务需求。

在本案中是利用通过init.rc启动系统服务来运行对应的bin服务文件;

1.Android启动文件系统后调用的会调用第一个应用程序是/init,此文件一个很重要的内容就是解析了init.rc和init.xxx.rc,然后执行解析出来的任务。而init.rc,可以在系统的初始化过程中进行一些简单的初始化操作。利用这一点,可以编写简单的关机或重启的sh脚本文件,通过系统init解析,执行相应的操作。

以mtk 6795平台工程为例(后文都是此平台),在device/amt/amt6795_evb_m/init.project.rc 文件中添加如下代码:

[java] view plain copy
  1. on post-fs-data //在此节点下添加如下代码  
  2.     chmod 0777 /system/bin/cloudtestsuited  
  3.   
  4. on init // 在此节点下添加如下代码  
  5. service cloudtestsuited /system/bin/cloudtestsuited  
  6.          class main  
  7.          oneshot  
  8.          disabled  

oneshot选项表示该服务只启动一次,而如果没有oneshot选项,这个可执行程序会一直存在--如果可执行程序被杀死,则会重新启动。

disabled 表示禁用服务,此服务开机时不会自动启动,但是可以在应用程序中手动启动它。

参考代码文件:

[plain] view plain copy
  1. # MTK project .rc configure  
  2.   
  3. import init.mt6795.usb.rc  
  4.   
  5. on init  
  6.     mkdir /mnt/media_rw/usbotg 0700 media_rw media_rw  
  7.     mkdir /storage/usbotg 0700 root root  
  8.   
  9. on post-fs-data  
  10.   
  11. #  
  12. # Connectivity related device nodes & configuration (begin)  
  13. #  
  14.   
  15. #/dev/ttyMT2 for Connectivity BT/FM/GPS usage  
  16.     chmod 0660 /dev/ttyMT2  
  17.     chown system system /dev/ttyMT2  
  18.   
  19.   
  20. # STP, WMT, GPS, FM and BT Driver  
  21. #   insmod /system/lib/modules/mtk_hif_sdio.ko  
  22. #   insmod /system/lib/modules/mtk_stp_wmt.ko  
  23. #   insmod /system/lib/modules/mtk_stp_uart.ko  
  24. #   insmod /system/lib/modules/mtk_stp_gps.ko  
  25. #   insmod /system/lib/modules/mtk_stp_bt.ko  
  26. #   insmod /system/lib/modules/mtk_fm_drv.ko  
  27. #   insmod /system/lib/modules/mtk_wmt_wifi.ko  
  28.   
  29. #SMB  
  30.     chown system system /proc/smb/ScreenComm  
  31.     chmod 0660 /proc/smb/ScreenComm  
  32.       
  33. # Create char device file for WMT, GPS, BT, FM, WIFI  
  34. #    mknod /dev/stpwmt c 190 0;  
  35. #    mknod /dev/stpgps c 191 0;  
  36. #    mknod /dev/stpbt  c 192 0;  
  37.   
  38. #    chmod 0660 /dev/stpwmt  
  39. #    chown system system /dev/stpwmt  
  40.       
  41. #    chmod 0660 /dev/wmtdetect  
  42. #    chown system system /dev/wmtdetect  
  43.           
  44.     mknod /dev/wmtWifi c 153 0  
  45.     chmod 0660 /dev/wmtWifi  
  46.     chown system system /dev/wmtWifi  
  47. #Camera  
  48.     chmod 0660 /dev/MAINAF  
  49.     chown system camera /dev/MAINAF  
  50.   
  51.     chmod 0660 /dev/MAINAF2  
  52.     chown system camera /dev/MAINAF2  
  53.   
  54.     chmod 0660 /dev/SUBAF  
  55.     chown system camera /dev/SUBAF  
  56.   
  57.     chmod 0660 /dev/GAF001AF  
  58.     chown system camera /dev/GAF001AF  
  59.      
  60.     chmod 0660 /dev/DW9714AF  
  61.     chown system camera /dev/DW9714AF  
  62.       
  63.     chmod 0660 /dev/AD5820AF  
  64.     chown system camera /dev/AD5820AF  
  65.       
  66.     chmod 0660 /dev/BU64745GWZAF  
  67.     chown system camera /dev/BU64745GWZAF  
  68.       
  69.     chmod 0660 /dev/LC898212AF  
  70.     chown system camera /dev/LC898212AF  
  71.   
  72.     chmod 0660 /dev/LC898122AF  
  73.     chown system camera /dev/LC898122AF  
  74.   
  75. # BT  
  76. #    chmod 0660 /dev/stpbt  
  77. #    chown bluetooth radio /dev/stpbt  
  78.   
  79. # Add by Janning begin  
  80.     chmod 0777 /system/bin/cloudtestsuited  
  81. # Add by Janning end  
  82.   
  83. # GPS  
  84. #    chown gps gps /dev/stpgps  
  85.     chown gps gps /sys/class/gpsdrv/gps/pwrctl  
  86.     chown gps gps /sys/class/gpsdrv/gps/suspend  
  87.     chown gps gps /sys/class/gpsdrv/gps/state  
  88.     chown gps gps /sys/class/gpsdrv/gps/pwrsave  
  89.     chown gps gps /sys/class/gpsdrv/gps/status  
  90. #    chmod 0660 /dev/stpgps  
  91.   
  92. # WiFi  
  93.     mkdir /data/misc/wifi 0770 wifi wifi  
  94.     mkdir /data/misc/wifi/sockets 0770 wifi wifi  
  95.     mkdir /data/misc/wpa_supplicant 0770 wifi wifi   
  96.     chown wifi wifi /data/misc/wifi  
  97.   
  98. # ANT  
  99.     chmod 0660 /dev/stpant  
  100.     chown ant radio /dev/stpant  
  101.   
  102. #Disable for one Single loader  
  103. # Load WiFi Driver  
  104. #   insmod /system/lib/modules/wlan_mt.ko  
  105.   
  106. # Char device for BT 3.0 HS  
  107.     mknod /dev/ampc0 c 151 0  
  108.     chown bluetooth bluetooth /dev/ampc0  
  109.     chmod 0660 /dev/ampc0  
  110.   
  111. #  
  112. # Connectivity related device nodes & configuration (end)  
  113. #  
  114.   
  115.   
  116. on init  
  117.     # Refer to http://source.android.com/devices/tech/storage/index.html  
  118.     # It said, "Starting in Android 4.4, multiple external storage devices are surfaced to developers through   
  119.     #           Context.getExternalFilesDirs(), Context.getExternalCacheDirs(), and Context.getObbDirs().  
  120.     #           External storage devices surfaced through these APIs must be a semi-permanent part of the device (such as an SD card slot in a battery compartment).  
  121.     #           Developers expect data stored in these locations to be available over long periods of time."  
  122.     # Therefore, if the target doesn't support sd hot-plugging (Ex: the SD card slot in a battery compartment), we need to export SECONDARY_STORAGE in 'boot' section  
  123.     #   
  124.     # export SECONDARY_STORAGE /storage/sdcard1  
  125.   
  126. service fuse_usbotg /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/usbotg /storage/usbotg  
  127.     class late_start  
  128.     disabled  
  129.   
  130. #  
  131. # Connectivity related services (Begin)  
  132. #  
  133.   
  134. service wmt_loader /system/bin/wmt_loader  
  135.     class core  
  136.     user root  
  137.     group root  
  138.     oneshot  
  139.   
  140. service 66xx_launcher /system/bin/6620_launcher -m 4 -p /system/etc/firmware/  
  141.     user system  
  142.     group system  
  143.     class core  
  144.   
  145. on property:service.wcn.coredump.mode=2  
  146. start stp_dump  
  147.   
  148. service stp_dump /system/bin/stp_dump3  
  149.     user root  
  150.     group root  
  151.     class core  
  152.     disabled  
  153.     oneshot  
  154.   
  155. # Add by Janning begin  
  156. service cloudtestsuited /system/bin/cloudtestsuited  
  157.     class main  
  158.     disabled  
  159. # Add by Janning end  
  160.   
  161. #  
  162. # Connectivity related services (End)  
  163. #  

2.添加对应的selinux权限

在device\mediatek\common\sepolicy\file_contexts 文件中添加bin服务对应的权限:

[java] view plain copy
  1. # Add by silead begin  
  2. /system/bin/cloudtestsuited u:object_r:fpsvcd_exec:s0  //此行  
  3. # Add by silead end  
device\mediatek\common\sepolicy\system_app.te 文件中添加bin服务对应的权限:

[java] view plain copy
  1. # Add by silead 2016/03/18 begin  
  2. # add for fp.apk create file under '/data/silead/' file path  
  3. allow system_app fpsvcd_data_file:dir { create write add_name remove_name read open search};  
  4. allow system_app fpsvcd_data_file:file { unlink getattr create write open read };  
  5. # add for starting cloudtestsuited in apk  
  6. allow system_app fpsvcd_tmpfs:file { read write open getattr };  
  7. allow system_app fpsvcd_exec:file { getattr read execute open execute_no_trans };  
  8. allow system_app fpsvcd:dir { read open };  
  9. allow system_app tmpfs:dir { read write getattr };  
  10. # Add by silead 2016/03/18 end  
device\mediatek\common\sepolicy\ 目录下新增一个权限文件fpsvcd.te:
[java] view plain copy
  1. type fpsvcd_exec , exec_type, file_type;  
  2. type fpsvcd ,domain;  
  3. init_daemon_domain(fpsvcd)  
  4.   
  5. allow fpsvcd fpsvcd:capability { sys_nice dac_override net_admin};  
  6. allow fpsvcd fpsvcd:capability2 { block_suspend };  
  7. allow fpsvcd init_tmpfs:file {getattr read open};  
  8. allow fpsvcd tmpfs:dir { write add_name };  
  9. allow fpsvcd fpsvcd_tmpfs:file { write create read open};  
  10. allow fpsvcd silead_fp_dev_device:chr_file { read write ioctl open };  
  11. allow fpsvcd uhid_device:chr_file { write open ioctl};  
  12. allow fpsvcd fpsvcd:netlink_kobject_uevent_socket {create read write setopt bind };  
  13. allow fpsvcd sysfs_wake_lock:file {write read open};  
  14. allow fpsvcd system_app:dir { read open };  
  15. #allow fpsvcd system_data_file:dir { create write add_name read open };  
  16. #allow fpsvcd system_data_file:file { create write open read };  
  17. allow fpsvcd fpsvcd_data_file:dir { create write add_name remove_name read open search};  
  18. allow fpsvcd fpsvcd_data_file:file {unlink getattr create write open read };  
  19. #allow fpsvcd silead_data_file:dir { search create write add_name read open };  
  20. #allow fpsvcd silead_data_file:file { create write open read getattr };  
  21. allow fpsvcd platform_app_tmpfs:file { open read write };  
  22. allow fpsvcd fingerprintd:dir { open read  };  
  23. allow fpsvcd fuse:dir { search open add_name remove_name read write create};  
  24. allow fpsvcd fuse:file { unlink open read write create getattr setattr rename};  
  25. allow fpsvcd property_socket:sock_file { write };  
  26. allow fpsvcd init:unix_stream_socket { connectto };  
  27. allow fpsvcd system_prop:property_service { set };   
具体参考代码:

[plain] view plain copy
  1. #  
  2. #############################  
  3. # Custom files  
  4. /custom(/.*)?       u:object_r:custom_file:s0  
  5.   
  6. /dev/block/mtd(.*)?     u:object_r:mtd_device:s0  
  7.   
  8. #############################  
  9. # Executables  
  10. # Meta/Factory Mode multi_init  
  11. /sbin/multi_init        u:object_r:init_exec:s0  
  12.   
  13.   
  14. #############################  
  15. # Data files  
  16. #  
  17. /data/aee_exp(/.*)?  u:object_r:aee_exp_data_file:s0  
  18. /data/agps_supl(/.*)?    u:object_r:agpsd_data_file:s0  
  19. /data/misc/gps(/.*)?   u:object_r:gps_data_file:s0  
  20. /data/anr/SF_RTT(/.*)? u:object_r:sf_rtt_file:s0  
  21. /data/app/mcRegistry(/.*)? u:object_r:mobicore_data_file:s0  
  22. /data/ccci_cfg(/.*)? u:object_r:ccci_cfg_file:s0  
  23. /data/flashless(/.*)? u:object_r:c2k_file:s0  
  24. /data/core(/.*)? u:object_r:aee_core_data_file:s0  
  25. /data/dontpanic(/.*)? u:object_r:dontpanic_data_file:s0  
  26. /data/dumpsys(/.*)?    u:object_r:aee_dumpsys_data_file:s0  
  27. /data/extmdl(/.*)? u:object_r:mdlog_data_file:s0  
  28. /data/http-proxy-cfg(/.*)? u:object_r:http_proxy_cfg_data_file:s0  
  29. /data/log_temp(/.*)? u:object_r:logtemp_data_file:s0  
  30. /data/lost\+found(/.*)? u:object_r:lost_found_data_file:s0  
  31. /data/mdlog(/.*)? u:object_r:mdlog_data_file:s0  
  32. /data/mdl(/.*)? u:object_r:mdlog_data_file:s0  
  33. /data/mdl3(/.*)? u:object_r:mdlog_data_file:s0  
  34. /data/mediaserver(/.*)? u:object_r:mediaserver_data_file:s0  
  35. /data/misc/acdapi(/.*)? u:object_r:acdapi_data_file:s0  
  36. /data/misc/akmd_set.txt u:object_r:akmd8963_access_file1:s0  
  37. /data/misc/mblog(/.*)? u:object_r:logmisc_data_file:s0  
  38. /data/misc/xlog(/.*)? u:object_r:xlog_data_file:s0  
  39. /data/misc/PDC.ini u:object_r:akmd8963_access_file2:s0  
  40. /data/misc/ppp(/.*)? u:object_r:ppp_data_file:s0  
  41. /data/.tp(/.*)? u:object_r:thermal_manager_data_file:s0  
  42. /data/misc/radvd(/.*)? u:object_r:radvd_data_file:s0  
  43. /data/misc/sensor.log       u:object_r:bmm050_sensor_log_file:s0  
  44. /data/misc/sensor(/.*)?     u:object_r:sensor_data_file:s0  
  45. /data/misc/stp_dump(/.*)? u:object_r:stp_dump_data_file:s0  
  46. /data/misc/wide-dhcpv6(/.*)? u:object_r:wide_dhcpv6_data_file:s0  
  47. /data/misc/wpa_supplicant(/.*)? u:object_r:wpa_supplicant_data_file:s0  
  48. /data/nfc_socket(/.*)? u:object_r:nfc_socket:s0  
  49. /data/nvram(/.*)? u:object_r:nvram_data_file:s0  
  50. /data/cct(/.*)? u:object_r:cct_data_file:s0  
  51. /data/md3(/.*)? u:object_r:c2k_file:s0  
  52. /nvdata(/.*)? u:object_r:nvdata_file:s0  
  53. /data/SF_dump(./*)? u:object_r:sf_bqdump_data_file:s0  
  54. /data/ipsec(./*)? u:object_r:wod_ipsec_conf_file:s0  
  55. /data/ipsec/wo(./*)? u:object_r:wod_apn_conf_file:s0  
  56. /data/data_tmpfs_log(/.*)? u:object_r:data_tmpfs_log_file:s0  
  57. /data/tmp_mnt/data_tmpfs_log(/.*)? u:object_r:data_tmpfs_log_file:s0  
  58. /data/setkey.conf        u:object_r:ims_ipsec_data_file:s0  
  59. /data/setkey_bak.conf    u:object_r:ims_ipsec_data_file:s0  
  60. /data/setkey_latest.conf u:object_r:ims_ipsec_data_file:s0  
  61. /data/key_provisioning(/.*)?         u:object_r:key_install_data_file:s0  
  62.   
  63. ##########################  
  64. # Devices  
  65. #  
  66. /dev/aal_als(/.*)? u:object_r:aal_als_device:s0  
  67. /dev/accdet(/.*)? u:object_r:accdet_device:s0  
  68. /dev/AD5820AF(/.*)? u:object_r:AD5820AF_device:s0  
  69. /dev/aed[0-9]+ u:object_r:aed_device:s0  
  70. /dev/als_ps(/.*)? u:object_r:als_ps_device:s0  
  71. /dev/ampc0(/.*)? u:object_r:ampc0_device:s0  
  72. /dev/android(/.*)? u:object_r:android_device:s0  
  73. /dev/barometer(/.*)? u:object_r:barometer_device:s0  
  74. /dev/humidity(/.*)? u:object_r:humidity_device:s0  
  75. /dev/block/zram0(/.*)? u:object_r:zram0_device:s0  
  76. /dev/bmtpool(/.*)? u:object_r:bmtpool_device:s0  
  77. /dev/bootimg(/.*)? u:object_r:bootimg_device:s0  
  78. /dev/BOOT(/.*)? u:object_r:BOOT_device:s0  
  79. /dev/btif(/.*)? u:object_r:btif_device:s0  
  80. /dev/btn(/.*)? u:object_r:btn_device:s0  
  81. /dev/BU6429AF(/.*)? u:object_r:BU6429AF_device:s0  
  82. /dev/BU64745GWZAF(/.*)? u:object_r:BU64745GWZAF_device:s0  
  83. /dev/MAINAF(/.*)? u:object_r:MAINAF_device:s0  
  84. /dev/MAIN2AF(/.*)? u:object_r:MAIN2AF_device:s0  
  85. /dev/SUBAF(/.*)? u:object_r:SUBAF_device:s0  
  86. /dev/cache(/.*)? u:object_r:cache_device:s0  
  87. /dev/CAM_CAL_DRV(/.*)? u:object_r:CAM_CAL_DRV_device:s0  
  88. /dev/camera-fdvt(/.*)? u:object_r:camera_fdvt_device:s0  
  89. /dev/camera-isp(/.*)? u:object_r:camera_isp_device:s0  
  90. /dev/camera-pipemgr(/.*)? u:object_r:camera_pipemgr_device:s0  
  91. /dev/camera-sysram(/.*)? u:object_r:camera_sysram_device:s0  
  92. /dev/ccci_monitor     u:object_r:ccci_monitor_device:s0  
  93. /dev/ccci.* u:object_r:ccci_device:s0  
  94. /dev/cpu_dma_latency(/.*)? u:object_r:cpu_dma_latency_device:s0  
  95. /dev/devmap(/.*)? u:object_r:devmap_device:s0  
  96. /dev/dummy_cam_cal(/.*)? u:object_r:dummy_cam_cal_device:s0  
  97. /dev/DW9714AF(/.*)? u:object_r:DW9714AF_device:s0  
  98. /dev/DW9814AF(/.*)? u:object_r:DW9814AF_device:s0  
  99. /dev/AK7345AF(/.*)? u:object_r:AK7345AF_device:s0  
  100. /dev/DW9714A(/.*)? u:object_r:DW9714A_device:s0  
  101. /dev/DW9718AF(/.*)? u:object_r:DW9718AF_device:s0  
  102. /dev/WV511AAF(/.*)? u:object_r:lens_device:s0  
  103. /dev/ebc(/.*)? u:object_r:ebc_device:s0  
  104. /dev/ebr[0-9]+ u:object_r:ebr_device:s0  
  105. /dev/eemcs.* u:object_r:eemcs_device:s0  
  106. /dev/emd.* u:object_r:emd_device:s0  
  107. /dev/etb        u:object_r:etb_device:s0  
  108. /dev/exm0(/.*)? u:object_r:exm0_device:s0  
  109. /dev/expdb(/.*)? u:object_r:expdb_device:s0  
  110. /dev/fat(/.*)? u:object_r:fat_device:s0  
  111. /dev/FM50AF(/.*)? u:object_r:FM50AF_device:s0  
  112. /dev/fm(/.*)? u:object_r:fm_device:s0  
  113. /dev/gps(/.*)? u:object_r:gps_device:s0  
  114. /dev/gsensor(/.*)? u:object_r:gsensor_device:s0  
  115. /dev/gyroscope(/.*)? u:object_r:gyroscope_device:s0  
  116. /dev/hdmitx(/.*)? u:object_r:graphics_device:s0  
  117. /dev/hid-keyboard(/.*)? u:object_r:hid_keyboard_device:s0  
  118. /dev/hotknot(/.*)? u:object_r:hotknot_device:s0  
  119. /dev/hwmsensor(/.*)? u:object_r:hwmsensor_device:s0  
  120. /dev/ion(/.*)? u:object_r:ion_device:s0  
  121. /dev/kd_camera_flashlight(/.*)? u:object_r:kd_camera_flashlight_device:s0  
  122. /dev/kd_camera_hw_bus2(/.*)? u:object_r:kd_camera_hw_bus2_device:s0  
  123. /dev/kd_camera_hw(/.*)? u:object_r:kd_camera_hw_device:s0  
  124. /dev/LC898122AF(/.*)? u:object_r:LC898122AF_device:s0  
  125. /dev/LC898212AF(/.*)? u:object_r:LC898212AF_device:s0  
  126. /dev/logo(/.*)? u:object_r:logo_device:s0  
  127. /dev/loop-control(/.*)? u:object_r:loop-control_device:s0  
  128. /dev/M4U_device(/.*)? u:object_r:M4U_device_device:s0  
  129. /dev/m_acc_misc(/.*)? u:object_r:m_acc_misc_device:s0  
  130. /dev/mali.* u:object_r:gpu_device:s0  
  131. /dev/MATV(/.*)? u:object_r:MATV_device:s0  
  132. /dev/m_batch_misc(/.*)? u:object_r:m_batch_misc_device:s0  
  133. /dev/mbr(/.*)? u:object_r:mbr_device:s0  
  134. /dev/md32(/.*)? u:object_r:md32_device:s0  
  135. /dev/scp(/.*)? u:object_r:scp_device:s0  
  136. /dev/met(/.*)? u:object_r:met_device:s0  
  137. /dev/misc-sd(/.*)? u:object_r:misc_sd_device:s0  
  138. /dev/misc(/.*)? u:object_r:misc_device:s0  
  139. /dev/misc2(/.*)? u:object_r:misc2_device:s0  
  140. /dev/MJC(/.*)? u:object_r:MJC_device:s0  
  141. /dev/m_mag_misc(/.*)? u:object_r:m_mag_misc_device:s0  
  142. /dev/mmp(/.*)? u:object_r:mmp_device:s0  
  143. /dev/mobicore u:object_r:mobicore_admin_device:s0  
  144. /dev/mobicore-user u:object_r:mobicore_user_device:s0  
  145. /dev/t-base-tui u:object_r:mobicore_tui_device:s0  
  146. /dev/msensor(/.*)? u:object_r:msensor_device:s0  
  147. /dev/MT6516_H264_DEC(/.*)? u:object_r:MT6516_H264_DEC_device:s0  
  148. /dev/mt6516-IDP(/.*)? u:object_r:mt6516_IDP_device:s0  
  149. /dev/MT6516_Int_SRAM(/.*)? u:object_r:MT6516_Int_SRAM_device:s0  
  150. /dev/mt6516-isp(/.*)? u:object_r:mt6516_isp_device:s0  
  151. /dev/mt6516_jpeg(/.*)? u:object_r:mt6516_jpeg_device:s0  
  152. /dev/MT6516_MM_QUEUE(/.*)? u:object_r:MT6516_MM_QUEUE_device:s0  
  153. /dev/MT6516_MP4_DEC(/.*)? u:object_r:MT6516_MP4_DEC_device:s0  
  154. /dev/MT6516_MP4_ENC(/.*)? u:object_r:MT6516_MP4_ENC_device:s0  
  155. /dev/mt6605 u:object_r:mt6605_device:s0  
  156. /dev/mt9p012(/.*)? u:object_r:mt9p012_device:s0  
  157. /dev/mtfreqhopping(/.*)? u:object_r:mtfreqhopping_device:s0  
  158. /dev/mtgpio(/.*)? u:object_r:mtgpio_device:s0  
  159. /dev/mtk-adc-cali(/.*)? u:object_r:mtk-adc-cali_device:s0  
  160. /dev/mtk_disp.* u:object_r:graphics_device:s0  
  161. /dev/mtkfb_vsync(/.*)? u:object_r:graphics_device:s0  
  162. /dev/mtkg2d(/.*)? u:object_r:mtkg2d_device:s0  
  163. /dev/mtk_jpeg(/.*)? u:object_r:mtk_jpeg_device:s0  
  164. /dev/mtk-kpd(/.*)? u:object_r:mtk_kpd_device:s0  
  165. /dev/mtk_sched(/.*)? u:object_r:mtk_sched_device:s0  
  166. /dev/MTK_SMI(/.*)? u:object_r:MTK_SMI_device:s0  
  167. /dev/mtk_rrc(/.*)? u:object_r:mtk_rrc_device:s0  
  168. /dev/mt-mdp(/.*)? u:object_r:mt_mdp_device:s0  
  169. /dev/mt_otg_test(/.*)? u:object_r:mt_otg_test_device:s0  
  170. /dev/MT_pmic_adc_cali        u:object_r:MT_pmic_adc_cali_device:s0  
  171. /dev/MT_pmic_adc_cali(/.*)? u:object_r:MT_pmic_cali_device:s0  
  172. /dev/MT_pmic(/.*)? u:object_r:MT_pmic_device:s0  
  173. /dev/network.* u:object_r:network_device:s0  
  174. /dev/nvram(/.*)? u:object_r:nvram_device:s0  
  175. /dev/nxpspk(/.*)? u:object_r:smartpa_device:s0  
  176. /dev/otp        u:object_r:otp_device:s0  
  177. /dev/pmem_multimedia(/.*)? u:object_r:pmem_multimedia_device:s0  
  178. /dev/pmt(/.*)? u:object_r:pmt_device:s0  
  179. /dev/preloader(/.*)? u:object_r:preloader_device:s0  
  180. /dev/pro_info(/.*)? u:object_r:pro_info_device:s0  
  181. /dev/protect_f(/.*)? u:object_r:protect_f_device:s0  
  182. /dev/protect_s(/.*)? u:object_r:protect_s_device:s0  
  183. /dev/psaux(/.*)? u:object_r:psaux_device:s0  
  184. /dev/ptmx(/.*)? u:object_r:ptmx_device:s0  
  185. /dev/ptyp.* u:object_r:ptyp_device:s0  
  186. /dev/pvr_sync(/.*)? u:object_r:gpu_device:s0  
  187. /dev/qemu_pipe(/.*)? u:object_r:qemu_pipe_device:s0  
  188. /dev/recovery(/.*)? u:object_r:recovery_device:s0  
  189. /dev/rfkill(/.*)? u:object_r:rfkill_device:s0  
  190. /dev/rtc[0-9]+ u:object_r:rtc_device:s0  
  191. /dev/RT_Monitor(/.*)? u:object_r:RT_Monitor_device:s0  
  192. /dev/kick_powerkey(/.*)? u:object_r:kick_powerkey_device:s0  
  193. /dev/seccfg(/.*)? u:object_r:seccfg_device:s0  
  194. /dev/sec_ro(/.*)? u:object_r:sec_ro_device:s0  
  195. /dev/sec(/.*)? u:object_r:sec_device:s0  
  196. /dev/tee1 u:object_r:tee_part_device:s0  
  197. /dev/tee2 u:object_r:tee_part_device:s0  
  198. /dev/sensor(/.*)? u:object_r:sensor_device:s0  
  199. /dev/smartpa_i2c(/.*)? u:object_r:smartpa1_device:s0  
  200. /dev/snapshot(/.*)? u:object_r:snapshot_device:s0  
  201. /dev/socket/adbd(/.*)? u:object_r:adbd_socket:s0  
  202. /dev/socket/agpsd2(/.*)? u:object_r:agpsd_socket:s0  
  203. /dev/socket/agpsd3(/.*)? u:object_r:agpsd_socket:s0  
  204. /dev/socket/agpsd(/.*)? u:object_r:agpsd_socket:s0  
  205. /dev/socket/atci-audio(/.*)? u:object_r:atci_audio_socket:s0  
  206. /dev/socket/atci-serv-fw(/.*)? u:object_r:atci_serv_fw_socket:s0  
  207. /dev/socket/atci-service(/.*)? u:object_r:atci_service_socket:s0  
  208. /dev/socket/backuprestore(/.*)? u:object_r:backuprestore_socket:s0  
  209. /dev/socket/dfo(/.*)? u:object_r:dfo_socket:s0  
  210. /dev/socket/dnsproxyd(/.*)? u:object_r:dnsproxyd_socket:s0  
  211. /dev/socket/dumpstate(/.*)? u:object_r:dumpstate_socket:s0  
  212. /dev/socket/installd(/.*)? u:object_r:installd_socket:s0  
  213. /dev/socket/mdnsd(/.*)? u:object_r:mdnsd_socket:s0  
  214. /dev/socket/mdns(/.*)? u:object_r:mdns_socket:s0  
  215. /dev/socket/mnld(/.*)? u:object_r:mnld_socket:s0  
  216. /dev/socket/mtpd(/.*)? u:object_r:mtpd_socket:s0  
  217. /dev/socket/netdiag(/.*)? u:object_r:netdiag_socket:s0  
  218. /dev/socket/netd(/.*)? u:object_r:netd_socket:s0  
  219. /dev/socket/racoon(/.*)? u:object_r:racoon_socket:s0  
  220. /dev/socket/rild2-md2(/.*)? u:object_r:rild2_md2_socket:s0  
  221. /dev/socket/rild2(/.*)? u:object_r:rild2_socket:s0  
  222. /dev/socket/rild3(/.*)? u:object_r:rild3_socket:s0  
  223. /dev/socket/rild4(/.*)? u:object_r:rild4_socket:s0  
  224. /dev/socket/rild-mal(/.*)? u:object_r:rild_mal_socket:s0  
  225. /dev/socket/rild-mal-at(/.*)? u:object_r:rild_mal_at_socket:s0  
  226. /dev/socket/rild-mal-md2(/.*)? u:object_r:rild_mal_md2_socket:s0  
  227. /dev/socket/rild-mal-at-md2(/.*)? u:object_r:rild_mal_at_md2_socket:s0  
  228. /dev/socket/rild-ims(/.*)? u:object_r:rild_ims_socket:s0  
  229. /dev/socket/volte_imsm(/.*)? u:object_r:rild_imsm_socket:s0  
  230. /dev/socket/rild-atci-md2(/.*)? u:object_r:rild_atci_md2_socket:s0  
  231. /dev/socket/rild-atci(/.*)? u:object_r:rild_atci_socket:s0  
  232. /dev/socket/rild-vsim(/.*)? u:object_r:rild_vsim_socket:s0  
  233. /dev/socket/rild-vsim-md2(/.*)? u:object_r:rild_vsim_md2_socket:s0  
  234. /dev/socket/rild-ctclient u:object_r:rild_ctclient_socket:s0  
  235. /dev/socket/rild-debug-md2(/.*)? u:object_r:rild_debug_md2_socket:s0  
  236. /dev/socket/rild-debug(/.*)? u:object_r:rild_debug_socket:s0  
  237. /dev/socket/rild-dongle(/.*)? u:object_r:rild-dongle_socket:s0  
  238. /dev/socket/rild-md2(/.*)? u:object_r:rild_md2_socket:s0  
  239. /dev/socket/rild-mtk-modem-md2(/.*)? u:object_r:rild_mtk_modem_md2_socket:s0  
  240. /dev/socket/rild-mtk-modem(/.*)? u:object_r:rild_mtk_modem_socket:s0  
  241. /dev/socket/rild-mtk-ut-2-md2(/.*)? u:object_r:rild_mtk_ut_2_md2_socket:s0  
  242. /dev/socket/rild-mtk-ut-2(/.*)? u:object_r:rild_mtk_ut_2_socket:s0  
  243. /dev/socket/rild-mtk-ut-md2(/.*)? u:object_r:rild_mtk_ut_md2_socket:s0  
  244. /dev/socket/rild-mtk-ut(/.*)? u:object_r:rild_mtk_ut_socket:s0  
  245. /dev/socket/rild-oem-md2(/.*)? u:object_r:rild_oem_md2_socket:s0  
  246. /dev/socket/rild-oem(/.*)? u:object_r:rild_oem_socket:s0  
  247. /dev/socket/rild(/.*)? u:object_r:rild_socket:s0  
  248. /dev/socket/rild-via u:object_r:rild_via_socket:s0  
  249. /dev/socket/rild-atci-c2k(/.*)? u:object_r:rild_atci_c2k_socket:s0  
  250. /dev/socket/mal-mfi(/.*)? u:object_r:mal_mfi_socket:s0  
  251. /dev/socket/rpc u:object_r:rpc_socket:s0  
  252. /dev/socket/soc_vt_stk(/.*)? u:object_r:soc_vt_stk_socket:s0  
  253. /dev/socket/soc_vt_svc(/.*)? u:object_r:soc_vt_svc_socket:s0  
  254. /dev/socket/soc_vt_tcv(/.*)? u:object_r:soc_vt_tcv_socket:s0  
  255. /dev/socket/statusd u:object_r:statusd_socket:s0  
  256. /dev/socket/sysctl(/.*)? u:object_r:sysctl_socket:s0  
  257. /dev/socket/vold(/.*)? u:object_r:vold_socket:s0  
  258. /dev/socket/volte_stack(/.*)? u:object_r:volte_stack_socket:s0  
  259. /dev/socket/volte_imcb(/.*)? u:object_r:volte_imcb_socket:s0  
  260. /dev/socket/volte_ua(/.*)? u:object_r:volte_ua_socket:s0  
  261. /dev/socket/volte_imsa1(/.*)? u:object_r:volte_imsa1_socket:s0  
  262. /dev/socket/volte_imsvt1(/.*)? u:object_r:volte_imsvt1_socket:s0  
  263. /dev/socket/wpa_wlan0(/.*)? u:object_r:wpa_wlan0_socket:s0  
  264. /dev/socket/zygote(/.*)? u:object_r:zygote_socket:s0  
  265. /dev/socket/wod_action(/.*)? u:object_r:wod_action_socket:s0  
  266. /dev/socket/wod_sim(/.*)? u:object_r:wod_sim_socket:s0  
  267. /dev/socket/wod_ipsec(/.*)? u:object_r:wod_ipsec_socket:s0  
  268. /dev/socket/tunman(/.*)? u:object_r:tunman_socket:s0  
  269. /dev/stpant(/.*)? u:object_r:stpant_device:s0  
  270. /dev/stpbt(/.*)? u:object_r:stpbt_device:s0  
  271. /dev/stpgps        u:object_r:mnld_device:s0  
  272. /dev/stpgps(/.*)? u:object_r:stpgps_device:s0  
  273. /dev/stpwmt(/.*)? u:object_r:stpwmt_device:s0  
  274. /dev/sw_sync(/.*)? u:object_r:sw_sync_device:s0  
  275. /dev/tgt(/.*)? u:object_r:tgt_device:s0  
  276. /dev/touch(/.*)? u:object_r:touch_device:s0  
  277. /dev/tpd_em_log(/.*)? u:object_r:tpd_em_log_device:s0  
  278. /dev/ttyC0         u:object_r:gsm0710muxd_device:s0  
  279. /dev/ttyC1 u:object_r:mdlog_device:s0  
  280. /dev/ttyC2         u:object_r:agps_device:s0  
  281. /dev/ttyC3 u:object_r:icusb_device:s0  
  282. /dev/ttyGS.* u:object_r:ttyGS_device:s0  
  283. /dev/ttyMT.* u:object_r:ttyMT_device:s0  
  284. /dev/ttyp.* u:object_r:ttyp_device:s0  
  285. /dev/ttySDIO.* u:object_r:ttySDIO_device:s0  
  286. /dev/ttyUSB0         u:object_r:tty_device:s0  
  287. /dev/ttyUSB1         u:object_r:tty_device:s0  
  288. /dev/ttyUSB2         u:object_r:tty_device:s0  
  289. /dev/ttyUSB3         u:object_r:tty_device:s0  
  290. /dev/ttyUSB4         u:object_r:tty_device:s0  
  291. /dev/TV-out(/.*)? u:object_r:TV_out_device:s0  
  292. /dev/ubi_ctrl u:object_r:mtd_device:s0  
  293. /dev/ubi[_0-9]* u:object_r:mtd_device:s0  
  294. /dev/uboot(/.*)? u:object_r:uboot_device:s0  
  295. /dev/uibc(/.*)? u:object_r:uibc_device:s0  
  296. /dev/uinput(/.*)? u:object_r:uinput_device:s0  
  297. /dev/uio0(/.*)? u:object_r:uio0_device:s0  
  298. /dev/usrdata(/.*)? u:object_r:usrdata_device:s0  
  299. /dev/Vcodec(/.*)? u:object_r:Vcodec_device:s0  
  300. /dev/vmodem u:object_r:vmodem_device:s0  
  301. /dev/vow(/.*)? u:object_r:vow_device:s0  
  302. /dev/wmtdetect(/.*)? u:object_r:wmtdetect_device:s0  
  303. /dev/wmtWifi(/.*)? u:object_r:wmtWifi_device:s0  
  304. /dev/xlog u:object_r:xlog_device:s0  
  305. /dev/offloadservice(/.*)? u:object_r:offloadservice_device:s0  
  306. /dev/irtx u:object_r:irtx_device:s0  
  307. /dev/spm(/.*)? u:object_r:spm_device:s0  
  308.   
  309. # Add by silead begin  
  310. /dev/silead_fp_dev(/.*)?  u:object_r:silead_fp_dev_device:s0  
  311. # Add by silead end  
  312.   
  313. /dev/xt_qtaguid(/.*)? u:object_r:xt_qtaguid_device:s0  
  314. /dev/pmic_ftm(/.*)? u:object_r:pmic_ftm_device:s0  
  315. /dev/shf  u:object_r:shf_device:s0  
  316. /dev/block/platform/mtk-msdc\.0/by-name/proinfo  u:object_r:nvram_device:s0  
  317. /dev/block/platform/mtk-msdc\.0/by-name/nvram  u:object_r:nvram_device:s0  
  318. /dev/block/platform/mtk-msdc\.0/by-name/nvdata u:object_r:nvdata_device:s0  
  319. /dev/block/platform/mtk-msdc\.0/by-name/frp  u:object_r:frp_block_device:s0  
  320. /dev/block/platform/mtk-msdc\.0/by-name/expdb u:object_r:expdb_block_device:s0  
  321. /dev/block/platform/mtk-msdc\.0/by-name/misc2 u:object_r:misc2_block_device:s0  
  322. /dev/block/platform/mtk-msdc\.0/by-name/logo u:object_r:logo_block_device:s0  
  323. /dev/block/platform/mtk-msdc\.0/by-name/para u:object_r:para_block_device:s0  
  324. /dev/block/platform/mtk-msdc\.0/by-name/tee1 u:object_r:tee_block_device:s0  
  325. /dev/block/platform/mtk-msdc\.0/by-name/tee2 u:object_r:tee_block_device:s0  
  326. /dev/block/platform/mtk-msdc\.0/by-name/seccfg u:object_r:seccfg_block_device:s0  
  327. /dev/block/platform/mtk-msdc\.0/by-name/secro u:object_r:secro_block_device:s0  
  328. /dev/block/platform/mtk-msdc\.0/by-name/userdata u:object_r:userdata_block_device:s0  
  329. /dev/block/platform/mtk-msdc\.0/by-name/cache u:object_r:cache_block_device:s0  
  330. /dev/block/platform/mtk-msdc\.0/by-name/recovery u:object_r:recovery_block_device:s0  
  331. /dev/block/mmcblk0boot0 u:object_r:preloader_block_device:s0  
  332. /dev/block/mmcblk0boot1 u:object_r:preloader_block_device:s0  
  333. /dev/block/mmcblk0 u:object_r:mmcblk0_block_device:s0  
  334. /dev/block/mmcblk1 u:object_r:mmcblk1_block_device:s0  
  335. /dev/block/mmcblk1p1 u:object_r:mmcblk1p1_block_device:s0  
  336.   
  337. /protect_f(/.*)?         u:object_r:protect_f_data_file:s0  
  338. /protect_s(/.*)?         u:object_r:protect_s_data_file:s0  
  339. /persist(/.*)?         u:object_r:persist_data_file:s0  
  340. /dev/ttyACM0        u:object_r:ttyACM_device:s0  
  341. /dev/hrm       u:object_r:hrm_device:s0  
  342. /dev/trusty-ipc-dev0 u:object_r:tee_device:s0  
  343.   
  344. #############################  
  345. # sysfs files  
  346. #  
  347. /sys/bus/platform/drivers/gyrocope/chipinfo  u:object_r:gyroscope_mpud6050_chipinfo:s0  
  348. /sys/bus/platform/drivers/gyrocope/status  u:object_r:gyroscope_mpud6050_status:s0  
  349. /sys/bus/platform/drivers/msensor/daemon2 u:object_r:msensord_daemon2:s0  
  350. /sys/bus/platform/drivers/msensor/daemon u:object_r:msensord_daemon:s0  
  351. /sys/class/i2c-adapter/(/.*)?  u:object_r:gyroscope_mpud6050_use:s0  
  352. /sys/class/invensense_daemon_class/invensense_daemon_device(/.*)?  u:object_r:gyroscope_mpud6050_file:s0  
  353. /sys/devices/platform/gsensor/driver(/.*)?  u:object_r:sysfs_gsensor_file:s0  
  354. /sys/devices/platform/msensor/driver(/.*)?  u:object_r:sysfs_msensor_file:s0  
  355. /sys/bus/platform/drivers/mtk-kpd(/.*)? u:object_r:sysfs_keypad_file:s0  
  356. /sys/power/vcorefs/pwr_ctrl -- u:object_r:sysfs_vcorefs_pwrctrl:s0  
  357. /sys/devices/virtual/misc/scp(/.*)?  u:object_r:sysfs_scp:s0  
  358.   
  359.   
  360. #############################  
  361. # System files  
  362. #  
  363. /system/app/mcRegistry(/.*)? u:object_r:mobicore_data_file:s0  
  364. /system/bin/6620_launcher u:object_r:mtk_6620_launcher_exec:s0  
  365. /system/bin/stp_dump3 u:object_r:stp_dump3_exec:s0  
  366. /system/bin/aal u:object_r:aal_exec:s0  
  367. /system/bin/aee_core_forwarder u:object_r:aee_core_forwarder_exec:s0  
  368. /system/bin/akmd09911 u:object_r:akmd09911_exec:s0  
  369. /system/bin/akmd09912 u:object_r:akmd09912_exec:s0  
  370. /system/bin/akmd8963 u:object_r:akmd8963_exec:s0  
  371. /system/bin/akmd8975 u:object_r:akmd8975_exec:s0  
  372. /system/bin/ami304d u:object_r:ami304d_exec:s0  
  373. /system/bin/atcid u:object_r:atcid_exec:s0  
  374. /system/bin/atci_service u:object_r:atci_service_exec:s0  
  375. /system/bin/audiocmdservice_atci u:object_r:audiocmdservice_atci_exec:s0  
  376. /system/bin/autokd u:object_r:autokd_exec:s0  
  377. /system/bin/batterywarning u:object_r:batterywarning_exec:s0  
  378. /system/bin/bmm050d u:object_r:bmm050d_exec:s0  
  379. /system/bin/bmm056d u:object_r:bmm056d_exec:s0  
  380. /system/bin/boot_logo_updater u:object_r:boot_logo_updater_exec:s0  
  381. /system/bin/br_app_data_service u:object_r:br_app_data_service_exec:s0  
  382. /system/bin/ccci_fsd u:object_r:ccci_fsd_exec:s0  
  383. /system/bin/ccci_mdinit u:object_r:ccci_mdinit_exec:s0  
  384. /system/bin/ccci_rpcd u:object_r:ccci_rpcd_exec:s0  
  385. /system/bin/dhcp6c u:object_r:dhcp6c_exec:s0  
  386. /system/bin/dm_agent_binder u:object_r:dm_agent_binder_exec:s0  
  387. /system/bin/dmlog u:object_r:dmlog_exec:s0  
  388. /system/bin/dongled u:object_r:usbdongled_exec:s0  
  389. /system/bin/eemcs_fsd u:object_r:eemcs_fsd_exec:s0  
  390. /system/bin/eemcs_mdinit u:object_r:eemcs_mdinit_exec:s0  
  391. /system/bin/emdlogger[0-9]+ u:object_r:emdlogger_exec:s0  
  392. /system/bin/em_svr u:object_r:em_svr_exec:s0  
  393. /system/bin/factory u:object_r:factory_exec:s0  
  394. /system/bin/flashlessd u:object_r:flashlessd_exec:s0  
  395. /system/bin/fuelgauged u:object_r:fuelgauged_exec:s0  
  396. /system/bin/ged_srv u:object_r:ged_srv_exec:s0  
  397. /system/bin/gas_srv    u:object_r:gas_srv_exec:s0  
  398. /system/bin/kpoc_charger u:object_r:kpoc_charger_exec:s0  
  399. /system/bin/geomagneticd u:object_r:geomagneticd_exec:s0  
  400. /system/bin/GoogleOtaBinder u:object_r:GoogleOtaBinder_exec:s0  
  401. /system/bin/gsm0710muxdmd2 u:object_r:gsm0710muxdmd2_exec:s0  
  402. /system/bin/gsm0710muxd u:object_r:gsm0710muxd_exec:s0  
  403. /system/bin/guiext-server u:object_r:guiext-server_exec:s0  
  404. /system/bin/icusbd u:object_r:icusbd_exec:s0  
  405. /system/bin/init.gprs-pppd u:object_r:zpppd_gprs_exec:s0  
  406. /system/bin/ipod u:object_r:ipod_exec:s0  
  407. /system/bin/ipo_swap u:object_r:ipo_swap_exec:s0  
  408. /system/bin/launchpppoe u:object_r:launchpppoe_exec:s0  
  409. /system/bin/matv u:object_r:matv_exec:s0  
  410. /system/bin/mc6420d u:object_r:mc6420d_exec:s0  
  411. /system/bin/mcDriverDaemon u:object_r:mobicore_exec:s0  
  412. /system/bin/mdlogger u:object_r:mdlogger_exec:s0  
  413. /system/bin/memsicd3416x u:object_r:memsicd3416x_exec:s0  
  414. /system/bin/memsicd u:object_r:memsicd_exec:s0  
  415. /system/bin/meta_tst u:object_r:meta_tst_exec:s0  
  416.    
  417. /system/bin/mmc_ffu u:object_r:mmc_ffu_exec:s0  
  418. /system/bin/emmc_rw_debug u:object_r:emmc_rw_debug_exec:s0  
  419. /system/bin/mvg_app u:object_r:mvg_app_exec:s0  
  420. /system/bin/mmp u:object_r:mmp_exec:s0  
  421. /system/bin/mobile_log_d u:object_r:mobile_log_d_exec:s0  
  422. /system/bin/mpud6050 u:object_r:mpud6050_exec:s0  
  423. /system/bin/msensord u:object_r:msensord_exec:s0  
  424. /system/bin/mtk_agpsd u:object_r:mtk_agpsd_exec:s0  
  425. /system/bin/MtkCodecService u:object_r:MtkCodecService_exec:s0  
  426. /system/bin/mtkrildmd2 u:object_r:mtkrildmd2_exec:s0  
  427. /system/bin/mtkrild u:object_r:mtkrild_exec:s0  
  428. /system/bin/muxreport u:object_r:muxreport_exec:s0  
  429. /system/bin/netdiag u:object_r:netdiag_exec:s0  
  430. /system/bin/nvram_agent_binder u:object_r:nvram_agent_binder_exec:s0  
  431. /system/bin/nvram_daemon u:object_r:nvram_daemon_exec:s0  
  432. /system/bin/orientationd u:object_r:orientationd_exec:s0  
  433. /system/bin/permission_check u:object_r:permission_check_exec:s0  
  434. /system/bin/poad u:object_r:poad_exec:s0  
  435. /system/bin/ppl_agent u:object_r:ppl_agent_exec:s0  
  436. /system/bin/pppd_dt u:object_r:pppd_dt_exec:s0  
  437. /system/bin/pppd_via u:object_r:pppd_via_exec:s0  
  438. /system/bin/pq u:object_r:pq_exec:s0  
  439. /system/bin/program_binary_service u:object_r:program_binary_exec:s0  
  440. /system/bin/resize2fs  --  u:object_r:resize_exec:s0  
  441. /system/bin/resize_ext4  --  u:object_r:resize_exec:s0  
  442. /system/bin/resmon u:object_r:resmon_exec:s0  
  443. /system/bin/rild_dongle u:object_r:ril-3gddaemon_exec:s0  
  444. /system/bin/s62xd u:object_r:s62xd_exec:s0  
  445. /system/bin/slpd u:object_r:slpd_exec:s0  
  446. /system/bin/sn u:object_r:sn_exec:s0  
  447. /system/bin/statusd u:object_r:statusd_exec:s0  
  448. /system/bin/terservice u:object_r:terservice_exec:s0  
  449. /system/bin/thermald u:object_r:thermald_exec:s0  
  450. /system/bin/thermal_manager u:object_r:thermal_manager_exec:s0  
  451. /system/bin/thermalloadalgod u:object_r:thermalloadalgod_exec:s0    
  452. /system/bin/thermal u:object_r:thermal_exec:s0  
  453. /system/bin/tiny_mkswap u:object_r:tiny_mkswap_exec:s0  
  454. /system/bin/tiny_swapon u:object_r:tiny_swapon_exec:s0  
  455. /system/bin/tune2fs u:object_r:tune2fs_exec:s0  
  456. /system/bin/viarild u:object_r:viarild_exec:s0  
  457. /system/bin/volte_imcb u:object_r:volte_imcb_exec:s0  
  458. /system/bin/volte_stack u:object_r:volte_stack_exec:s0  
  459. /system/bin/volte_ua u:object_r:volte_ua_exec:s0  
  460. /system/bin/wfca u:object_r:wfca_exec:s0  
  461. /system/bin/mtkmal u:object_r:mtkmal_exec:s0  
  462. /system/bin/wifi2agps u:object_r:wifi2agps_exec:s0  
  463. /system/bin/wmt_loader u:object_r:wmt_loader_exec:s0  
  464. /system/bin/xlog u:object_r:xlog_exec:s0  
  465. /system/bin/sbchk u:object_r:sbchk_exec:s0  
  466. /system/bin/OperaMaxSystem u:object_r:tunman_exec:s0  
  467. /system/etc/sensor(/.*)?    u:object_r:system_sensor_data_file:s0  
  468. /system/vendor/bin/pvrsrvctl u:object_r:pvrsrvctl_exec:s0  
  469. /system/xbin/BGW u:object_r:BGW_exec:s0  
  470. /system/xbin/mnld u:object_r:mnld_exec:s0  
  471. /system/bin/md_ctrl u:object_r:md_ctrl_exec:s0  
  472. /system/bin/cmddumper u:object_r:cmddumper_exec:s0  
  473. /system/bin/epdg_wod u:object_r:epdg_wod_exec:s0  
  474. /system/bin/ipsec u:object_r:ipsec_exec:s0  
  475. /system/bin/charon u:object_r:charon_exec:s0  
  476. /system/bin/starter u:object_r:starter_exec:s0  
  477. /system/bin/stroke u:object_r:stroke_exec:s0  
  478. /system/bin/istd8303 u:object_r:istd8303_exec:s0  
  479. /system/bin/spm_loader u:object_r:spm_loader_exec:s0  
  480. /system/bin/vtservice u:object_r:vtservice_exec:s0  
  481. /system/bin/hotknot_native_service u:object_r:hotknot_native_exec:s0  
  482. /system/bin/pppd_btdun u:object_r:pppd_btdun_exec:s0  
  483.   
  484. # Add by silead begin  
  485. /system/bin/fpsvcd u:object_r:fpsvcd_exec:s0  
  486. /system/bin/fpfslockd u:object_r:fpsvcd_exec:s0  
  487. /system/bin/cloudtestsuited u:object_r:fpsvcd_exec:s0  
  488. /system/bin/checksilead u:object_r:fpsvcd_exec:s0  
  489. # Add by silead end  
  490.   
  491. # Wallpaper file for smartbook  
  492. /data/system/users/[0-9]+/smartbook_wallpaper   u:object_r:wallpaper_file:s0  
  493.   
  494. #fat on nand image  
  495. /fat(/.*)?  u:object_r:fon_image_data_file:s0  
  496. type fpsvcd_exec , exec_type, file_type;  
  497. type fpsvcd ,domain;  
  498. init_daemon_domain(fpsvcd)  
  499.   
  500. allow fpsvcd fpsvcd:capability { sys_nice dac_override net_admin};  
  501. allow fpsvcd fpsvcd:capability2 { block_suspend };  
  502. allow fpsvcd init_tmpfs:file {getattr read open};  
  503. allow fpsvcd tmpfs:dir { write add_name };  
  504. allow fpsvcd fpsvcd_tmpfs:file { write create read open};  
  505. allow fpsvcd silead_fp_dev_device:chr_file { read write ioctl open };  
  506. allow fpsvcd uhid_device:chr_file { write open ioctl};  
  507. allow fpsvcd fpsvcd:netlink_kobject_uevent_socket {create read write setopt bind };  
  508. allow fpsvcd sysfs_wake_lock:file {write read open};  
  509. allow fpsvcd system_app:dir { read open };  
  510. #allow fpsvcd system_data_file:dir { create write add_name read open };  
  511. #allow fpsvcd system_data_file:file { create write open read };  
  512. allow fpsvcd fpsvcd_data_file:dir { create write add_name remove_name read open search};  
  513. allow fpsvcd fpsvcd_data_file:file {unlink getattr create write open read };  
  514. #allow fpsvcd silead_data_file:dir { search create write add_name read open };  
  515. #allow fpsvcd silead_data_file:file { create write open read getattr };  
  516. allow fpsvcd platform_app_tmpfs:file { open read write };  
  517. allow fpsvcd fingerprintd:dir { open read  };  
  518. allow fpsvcd fuse:dir { search open add_name remove_name read write create};  
  519. allow fpsvcd fuse:file { unlink open read write create getattr setattr rename};  
  520. allow fpsvcd property_socket:sock_file { write };  
  521. allow fpsvcd init:unix_stream_socket { connectto };  
  522. allow fpsvcd system_prop:property_service { set };   
  523. # ==============================================  
  524. # MTK Policy Rule  
  525. # ==============================================  
  526.   
  527. # permissive system_app;  
  528. typeattribute system_app mlstrustedsubject;  
  529.   
  530.   
  531. # Date : 2014/07/31  
  532. # Stage: BaseUT  
  533. # Purpose :[CdsInfo][CdsInfo uses net shell commands to get network information and write WI-FI MAC address by NVRAM]  
  534. # Package Name: com.mediatek.connectivity  
  535. allow system_app nvram_agent_binder:binder call;  
  536.   
  537. # Date: 2014/08/01  
  538. # Operation: BaseUT  
  539. # Purpose: [Settings][Settings used list views need velocity tracker access touch dev]  
  540. # Package: com.android.settings  
  541. allow system_app touch_device:chr_file { read ioctl open };  
  542.   
  543. # Date: 2014/08/04  
  544. # Stage: BaseUT  
  545. # Purpose: [MTKThermalManager][View thermal zones and coolers, and change thermal policies]  
  546. # Package Name: com.mediatek.mtkthermalmanager  
  547. allow system_app apk_private_data_file:dir getattr;  
  548. allow system_app asec_image_file:dir getattr;  
  549. allow system_app dontpanic_data_file:dir getattr;  
  550. allow system_app drm_data_file:dir getattr;  
  551. allow system_app install_data_file:file getattr;  
  552. allow system_app lost_found_data_file:dir getattr;  
  553. allow system_app media_data_file:dir getattr;  
  554. allow system_app property_data_file:dir getattr;  
  555. allow system_app shell_data_file:dir search;  
  556. allow system_app thermal_manager_exec:file { read execute open execute_no_trans };  
  557. allow system_app proc_thermal:dir search;  
  558. allow system_app proc_thermal:file { read getattr open write };  
  559. allow system_app proc_mtkcooler:dir search;  
  560. allow system_app proc_mtkcooler:file { read getattr open write };  
  561. allow system_app proc_mtktz:dir search;  
  562. allow system_app proc_mtktz:file  { read getattr open write };  
  563. allow system_app proc_slogger:file { read getattr open write };  
  564.   
  565. # Date: 2014/08/21  
  566. # Stage: BaseUT  
  567. # Purpose: [AtciService][Atci Service will use atci_serv_fw_socket to connect to atci_service which in native layer]  
  568. # Package Name: com.mediatek.atci.service  
  569. allow system_app atci_serv_fw_socket:sock_file write;  
  570. allow system_app atci_service:unix_stream_socket connectto;  
  571.   
  572. # Date: 2014/08/29  
  573. # Stage: BaseUT  
  574. # Purpose: [BatteryWarning][View update graphics]  
  575. # Package Name: com.mediatek.batterywarning  
  576. allow system_app guiext-server:binder { transfer call };  
  577.   
  578. # Date: 2015/07/24  
  579. # Stage: BaseUT  
  580. # Purpose: [HotKnot][HotKnot service will add into ServiceManager]  
  581. # Package Name: com.mediatek.hotknot.service  
  582. allow system_app mtk_hotknot_service:service_manager add;  
  583.   
  584. # Date: 2014/09/02  
  585. # Operation: BaseUT  
  586. # Purpose: [HotKnot][HotKnot service will use hoknot device node]  
  587. # Package: com.mediatek.hotknot.service  
  588. allow system_app hotknot_device:chr_file { read write ioctl open };  
  589.   
  590. # Date: 2014/09/02  
  591. # Operation: BaseUT  
  592. # Purpose: [HotKnot][HotKnot service will use devmap_device device node]  
  593. # Package: com.mediatek.hotknot.service  
  594. allow system_app devmap_device:chr_file { read ioctl open };  
  595.   
  596. # Date: 2014/09/02  
  597. # Operation: BaseUT  
  598. # Purpose: [HotKnot][HotKnot service will use mtkfb device node]  
  599. # Package: com.mediatek.hotknot.service  
  600. allow system_app graphics_device:chr_file { read write ioctl open };  
  601. allow system_app graphics_device:dir search;  
  602.   
  603. # Data : 2014/09/09  
  604. # Operation : Migration  
  605. # Purpose : [Privacy protection lock][com.mediatek.ppl need to bind ppl_agent service to read/write nvram file]  
  606. # Package name : com.mediatek.ppl  
  607.   
  608. allow system_app ppl_agent:binder call;  
  609.   
  610. # Date: 2014/10/7  
  611. # Operation: SQC  
  612. # Purpose: [sysoper][sysoper will create folder /cache/recovery]  
  613. # Package: com.mediatek.systemupdate.sysoper  
  614. allow system_app cache_file:dir { write create add_name };  
  615. allow system_app cache_file:file { write create open };  
  616.   
  617. # Date : 2014/10/08  
  618. # Operation : BaseUT  
  619. # Purpose : [op01 agps setting][mtk_agpsd establishes the local socket as agpsd for all A-GPS   
  620. #           application to do something with mtk_agpsd in system app]  
  621. # Package: com.mediatek.op01.plugin  
  622. unix_socket_connect(system_app, agpsd, mtk_agpsd);  
  623.   
  624. # Date : 2014/10/28  
  625. # Operation: SQC  
  626. # Purpose : ALPS01761930  
  627. # Package: com.android.settings  
  628. allow system_app asec_apk_file:file r_file_perms;  
  629.   
  630. # Date : WK14.46  
  631. # Operation : Migration  
  632. # Purpose : for MTK Emulator HW GPU  
  633. allow system_app qemu_pipe_device:chr_file rw_file_perms;  
  634.   
  635. # Date : WK14.46  
  636. # Operation : Migration  
  637. # Package: org.simalliance.openmobileapi.service  
  638. # Purpose : ALPS01820916, for SmartcardService  
  639. allow system_app system_app_data_file:file execute;  
  640.   
  641. # Date : 2014/11/17  
  642. # Operation: SQC  
  643. # Purpose : [Settings][Battery module will call batterystats API, and it will read /sys/kernel/debug/wakeup_sources]  
  644. # Package: com.android.settings  
  645. allow system_app debugfs:file r_file_perms;  
  646.   
  647. # Date : 2014/11/18  
  648. # Operation : SQC  
  649. # Purpose : for oma dm fota recovery update  
  650. allow system_app ctl_rbfota_prop:property_service set;  
  651.   
  652. # Date : 2014/11/19  
  653. # Operation: SQC  
  654. # Purpose: [Settings][RenderThread][operate device file failed]  
  655. # Package: com.android.settings  
  656. allow system_app proc_secmem:file rw_file_perms;  
  657.   
  658. # Date : 2014/11/20  
  659. # Operation: SQC  
  660. # Purpose: [Settings][Developer options module will communicate with all Services through binder call]  
  661. # Package: com.android.settings  
  662. binder_call(system_app, MtkCodecService)  
  663.   
  664. # Date : 2014/11/26  
  665. # Operation: SQC  
  666. # Purpose: [Settings][Browser][warning kernel API'selinux enforce violation:sdcardd' when do stress test with ' AT_ST_Browser_Test.rar']  
  667. # Package: com.android.settings  
  668. allow system_app platform_app_tmpfs:file write;  
  669.   
  670. # Date : 2015/01/13  
  671. # Operation: SQC  
  672. # Purpose: access ashmem of isolated_app  
  673. # Package: com.fw.upgrade.sysoper  
  674. dontaudit system_app isolated_app_tmpfs:file write;  
  675.   
  676. # Date : 2015/01/14  
  677. # Operation: SQC  
  678. # Purpose: access ashmem of untrusted_app  
  679. # Package: android.ui  
  680. dontaudit system_app untrusted_app_tmpfs:file write;  
  681.   
  682. # Date : 2015/01/27  
  683. # Operation: SQC  
  684. # Purpose: It's not normal behavior, that system_app want to access radio_file_data  
  685. # Package: android.ui  
  686. dontaudit system_app radio_data_file:dir search;  
  687.   
  688. # Date : WK15.30  
  689. # Operation : Migration  
  690. # Purpose : for device bring up, not to block early migration/sanity  
  691. allow system_app system_app_service:service_manager add;  
  692. allow system_app drmserver:drmservice openDecryptSession;  
  693.   
  694. # Date: 2015/07/24  
  695. # Stage: Migration  
  696. # Purpose: [MTKThermalManager][View thermal zones and coolers, and change thermal policies]  
  697. # Package Name: com.mediatek.mtkthermalmanager  
  698. allow system_app thermal_manager_data_file:file { open getattr read write create};  
  699. allow system_app thermal_manager_data_file:file { open setattr lock };  
  700. allow system_app thermal_manager_data_file:dir { search getattr open read write setattr add_name };  
  701.   
  702. # Add by silead 2016/03/18 begin  
  703. # add for fp.apk create file under '/data/silead/' file path  
  704. allow system_app fpsvcd_data_file:dir { create write add_name remove_name read open search};  
  705. allow system_app fpsvcd_data_file:file { unlink getattr create write open read };  
  706. # add for starting cloudtestsuited in apk  
  707. allow system_app fpsvcd_tmpfs:file { read write open getattr };  
  708. allow system_app fpsvcd_exec:file { getattr read execute open execute_no_trans };  
  709. allow system_app fpsvcd:dir { read open };  
  710. allow system_app tmpfs:dir { read write getattr };  
  711. # Add by silead 2016/03/18 end  
  712.   
  713. # Date: 2015/09/10  
  714. # Stage: Migration  
  715. # Purpose: [HotKnot] Allow HotKnot service to start/stop hotknot_native_service  
  716. allow system_app hotknot_prop:property_service set;  
3.最后就是在应用中启动该bin服务,有两种方式:

一,可以在init.rc中在声明service 前 添加一行代码,

           on property:sys.service.silead=enabled
                   start cloudtestsuited

      然后再apk中就可以执行如下代码,前提是apk具有platform签名,system权限:

//启动bin服务
            caseR.id.shutdown_btn2:
                Log.v(TAG,"system service->shutdown");
                SystemProperties.set("sys.service.silead","enabled");
                break;

       二, 可以在代码中直接通过调用cmd命令的方式启动bin服务:

      参考代码:

      

[java] view plain copy
  1. private void startCloudServer() {  
  2.     new Thread(new Runnable() {  
  3.         @Override  
  4.         public void run() {  
  5.             try {  
  6.                 Log.v(Const.TAG_LOG, TAG  
  7.                         + " startCloudServer->getRuntime cloudtestsuited");  
  8.                 //String[] cmd = new String[] { "su", "-c", "cloudtestsuited" };  
  9.                 String[] cmd = new String[] { "sh""-c""cloudtestsuited" };  
  10.                 //Process proc = Runtime.getRuntime().exec(cmd);  
  11.                 //proc.waitFor();  
  12.                 excuteCmd_multiThread(cmd);  
  13.             } catch (Exception e) {  
  14.                 Log.e(Const.TAG_LOG, TAG  
  15.                         + " startCloudServer occurs exception, ", e);  
  16.             }  
  17.             try {  
  18.                 Log.v(Const.TAG_LOG, TAG  
  19.                         + " startCloudServer->SystemProperties cloudtestsuited");  
  20.                 //SystemProperties.set("ctl.start", "ztstartsileadcloudtest");  
  21.             } catch (Exception e) {  
  22.                 Log.e(Const.TAG_LOG, TAG  
  23.                         + " startCloudServer occurs exception, ", e);  
  24.             }  
  25.         }  
  26.   
  27.     }).start();  
  28. }  
  29.   
  30. private void excuteCmd_multiThread(String[] cmd) {  
  31.     try {  
  32.         Process proc = Runtime.getRuntime().exec(cmd);  
  33.         Thread errorThread = new Thread(new InputStreamRunnable(  
  34.                 proc.getErrorStream(), "ErrorStream"));  
  35.         errorThread.start();  
  36.         Thread outputThread = new Thread(new InputStreamRunnable(  
  37.                 proc.getInputStream(), "OutputStream"));  
  38.         outputThread.start();  
  39.         proc.waitFor();  
  40.     } catch (InterruptedException e) {  
  41.         Log.e(Const.TAG_LOG, TAG  
  42.                 + " excuteCmd_multiThread occurs InterruptedException, ", e);  
  43.     } catch (IOException e) {  
  44.         Log.e(Const.TAG_LOG, TAG  
  45.                 + " excuteCmd_multiThread occurs IOException, ", e);  
  46.     }  
  47. }  
  48.   
  49. private class InputStreamRunnable implements Runnable {  
  50.     BufferedReader bReader = null;  
  51.     String type = null;  
  52.   
  53.     public InputStreamRunnable(InputStream is, String typeCode) {  
  54.         try {  
  55.             type = typeCode;  
  56.             bReader = new BufferedReader(new InputStreamReader(  
  57.                     new BufferedInputStream(is), "UTF-8"));  
  58.         } catch (Exception e) {  
  59.             Log.e(Const.TAG_LOG, TAG  
  60.                     + " InputStreamRunnable occurs exception, ", e);  
  61.         }  
  62.     }  
  63.   
  64.     @Override  
  65.     public void run() {  
  66.         String line;  
  67.         int lineNum = 0;  
  68.         try {  
  69.             while ((line = bReader.readLine()) != null) {  
  70.                 if ("ErrorStream".equals(type)) {  
  71.                     Log.e("FpCloudServer ERROR", line);  
  72.                 } else if ("OutputStream".equals(type)) {  
  73.                     Log.i("FpCloudServer Output", line);  
  74.                 } else {  
  75.                     Log.v("FpCloudServer debug", line);  
  76.                 }  
  77.                 lineNum++;  
  78.             }  
  79.             if (bReader != null) {  
  80.                 bReader.close();  
  81.             }  
  82.         } catch (Exception e) {  
  83.             Log.e(Const.TAG_LOG, TAG  
  84.                     + " InputStreamRunnable run occurs exception, ", e);  
  85.         }  
  86.     }  
  87. }  


以上即可实现在apk中调用启动bin服务文件。

具体apk实现代码可以参考 FpCloudTest.zip 附件: http://download.csdn.net/detail/jiuxiaoyunwu/9499487

相关selinux权限 即te权限的添加请参考:http://download.csdn.net/detail/jiuxiaoyunwu/9499570