【Android】hwbinder的selinux配置

1、android\o-base\vendor\xxx\attributes 添加

attribute hal_tv_xxx;

attribute hal_tv_xxx_client;

attribute hal_tv_skyworth_server;

2、android\o-base\vendor\xxx\hwservice_contexts

vendor.xxx.hardware.event::ITvEvent u:object_r:hal_tv_xxx_hwservice:s0

3、对应的file_contexts添加路径可以是(device、ventor)

/(vendor|system/vendor)/bin/hw/vendor\.xxx\.hardware\.event@1\.0-service u:object_r:hal_tv_xxx_default_exec:s0

4、添加文件(vendor\xxx\sepolicy)hwservice.te (sepolicy\public也可以,但是8.0会在vts的时候fail,因为找不到)

type hal_tv_xxx_hwservice, hwservice_manager_type;

5、添加文件(vendor\xxx\sepolicy)hal_tv_xxx.te(sepolicy\public也可以)

binder_call(hal_tv_xxx_client, hal_tv_xxx_server)

binder_call(hal_tv_xxx_server, hal_tv_xxx_client)

add_hwservice(hal_tv_xxx_server, hal_tv_xxx_hwservice)

allow hal_tv_xxx_client hal_tv_xxx_hwservice:hwservice_manager find;

6、添加文件(vendor\xxx\sepolicy)hal_tv_xxx_default.te (sepolicy\vendor也可以)

type hal_tv_xxx_default, domain;

hal_server_domain(hal_tv_xxx_default, hal_tv_xxx)

 

type hal_tv_xxx_default_exec, exec_type, vendor_file_type, file_type;

init_daemon_domain(hal_tv_xxx_default)

7、配置client,需要在你相关文件那一端配置,如在app中(system_app.te、system_server.te):

hal_client_domain(system_app,hal_tv_xxx)

hal_client_domain(system_server,hal_tv_xxx)

 

8、新增的selinux文件需要加到系统编译(BoardConfig.mk)

# SELinux

BOARD_SEPOLICY_DIRS += \

vendor/xxx/open/system/sepolicy \

device/xxx/open_uhd/sepolicy\

vendor/xxx/sepolicy

9、device.mk中添加

#oceantv HIDL

PRODUCT_PACKAGES += \

[email protected] \

[email protected]

10、manifest.xml中添加

vendor.xxx.hardware.event

hwbinder

1.0

ITvEvent

default

你可能感兴趣的:(安卓)