新增HIDL service需要修改的sepolicy文件整理

以添加 “android.hardware.lightnew@1.0-service” 为例,替换 lightnew 为自定义名称即可

1.  system/sepolicy/public/attributes

2. system/sepolicy/prebuilts/api/29.0/public/attributes

+ hal_attribute(lightnew);

 

//hal_attribute函数如下:

system/sepolicy/prebuilts/api/29.0/public/te_macros

#####################################
# hal_attribute(hal_name)
# Add an attribute for hal implementations along with necessary
# restrictions.
define(`hal_attribute', `
attribute hal_$1;
expandattribute hal_$1 true;
attribute hal_$1_client;
expandattribute hal_$1_client true;
attribute hal_$1_server;
expandattribute hal_$1_server false;

//所以后文的lightnew会有前缀hal_

 

3. 新建文件 system/sepolicy/public/hal_lightnew.te

4  新建文件system/sepolicy/prebuilts/api/29.0/public/hal_lightnew.te

# HwBinder IPC from client to server, and callbacks
binder_call(hal_lightnew_client, hal_lightnew_server)
binder_call(hal_lightnew_server, hal_lightnew_client)

hal_attribute_hwservice(hal_lightnew, hal_lightnew_hwservice)
 

5. 新建文件system/sepolicy/vendor/hal_lightnew_default.te

type hal_lightnew_default, domain;
hal_server_domain(hal_lightnew_default, hal_lightnew)

type hal_lightnew_default_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(hal_lightnew_default)

 

6.  system/sepolicy/private/hwservice_contexts

7. system/sepolicy/prebuilts/api/29.0/public/hwservice.te

+ android.hardware.lightnew::ILightnew                            u:object_r:hal_lightnew_hwservice:s0

 

8. system/sepolicy/private/system_server.te

9. system/sepolicy/prebuilts/api/29.0/private/system_server.te

+ hal_client_domain(system_server, hal_lightnew)

 

10. system/sepolicy/public/hwservice.te

11. system/sepolicy/prebuilts/api/29.0/public/hwservice.te

+ type hal_lightnew_hwservice, hwservice_manager_type;

 

12. system/sepolicy/vendor/file_contexts

+ /(vendor|system/vendor)/bin/hw/android\.hardware\.lightnew@1\.0-service       u:object_r:hal_lightnew_default_exec:s0

 

13. system/sepolicy/private/compat/26.0/26.0.ignore.cil
14. system/sepolicy/private/compat/27.0/27.0.ignore.cil
15. system/sepolicy/private/compat/28.0/28.0.ignore.cil

16. system/sepolicy/prebuilts/api/29.0/private/compat/26.0/26.0.ignore.cil
17. system/sepolicy/prebuilts/api/29.0/private/compat/27.0/27.0.ignore.cil
18. system/sepolicy/prebuilts/api/29.0/private/compat/28.0/28.0.ignore.cil

new_objects 中添加:

+ hal_lightnew_hwservice

 

19. system/sepolicy/private/app_neverallows.te

20. system/sepolicy/prebuilts/api/29.0/private/app_neverallows.te

all_untrusted_apps 中添加:

+   hal_lightnew_hwservice

 

//以下文件为通过VTS:

21. system/sepolicy/public/su.te

22. system/sepolicy/prebuilts/api/29.0/public/su.te

+ typeattribute su hal_lightnew_client;

 

 

 

  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值