[ALPS04707246] porting hdmi hidl service

Refactoring hdmi service as hidl service,so that
other process can call hdmi services API.
Add Selinux permission for hdmi hidl service.

MTK-Commit-Id: 0ecef9e52ce92b52413fbecd2b5be492806b8f53

Change-Id: I7f1c5f48d4ae9777acc80436a4af801f32969fac
CR-Id: ALPS04707246
Feature: [Module]Settings
This commit is contained in:
gtk_qingyunmei 2020-01-18 10:17:54 +08:00
parent 103246ae55
commit 060eb640e1
9 changed files with 85 additions and 0 deletions

View File

@ -74,3 +74,9 @@ attribute hal_atci_server;
# Date: 2019/06/12
# modem db filter hidl
attribute mtk_hal_md_dbfilter_server;
# Date: 2019/07/16
# HDMI HIDL
attribute hal_hdmi;
attribute hal_hdmi_client;
attribute hal_hdmi_server;

View File

@ -692,3 +692,6 @@
#MRDUMP
/dev/block/platform/bootdevice/by-name/mrdump(/.*)? u:object_r:mrdump_device:s0
# Date: 2019/07/16
# hdmi hal
/(system\/vendor|vendor)/bin/hw/vendor\.mediatek\.hardware\.hdmi@1\.0-service u:object_r:mtk_hal_hdmi_exec:s0

6
non_plat/hal_hdmi.te Normal file
View File

@ -0,0 +1,6 @@
# HwBinder IPC from clients into server, and callbacks
binder_call(hal_hdmi_client, hal_hdmi_server)
binder_call(hal_hdmi_server, hal_hdmi_client)
# give permission for hal client
allow hal_hdmi_client mtk_hal_hdmi_hwservice :hwservice_manager find;

View File

@ -54,3 +54,6 @@ type mtk_hal_gpu_hwservice, hwservice_manager_type;
# modem db filter hidl
type mtk_hal_md_dbfilter_hwservice, hwservice_manager_type;
# Date: 2019/07/16
# HDMI HIDL
type mtk_hal_hdmi_hwservice, hwservice_manager_type;

View File

@ -63,3 +63,7 @@ vendor.mediatek.hardware.modemdbfilter::ICopyDBFilter u:object_r:mtk_hal_md_dbfi
vendor.mediatek.hardware.camera.lomoeffect::ILomoEffect u:object_r:hal_camera_hwservice:s0
vendor.mediatek.hardware.camera.ccap::ICCAPControl u:object_r:hal_camera_hwservice:s0
vendor.mediatek.hardware.camera.bgservice::IBGService u:object_r:hal_camera_hwservice:s0
# Date : 2019/07/16
# HDMI HIDL
vendor.mediatek.hardware.hdmi::IMtkHdmiService u:object_r:mtk_hal_hdmi_hwservice:s0

48
non_plat/mtk_hal_hdmi.te Normal file
View File

@ -0,0 +1,48 @@
# ==============================================
# Policy File of /vendor/bin/hw/vendor.mediatek.hardware.hdmi@1.0-service Executable File
# ==============================================
# Type Declaration
# ==============================================
type mtk_hal_hdmi, domain;
type mtk_hal_hdmi_exec, exec_type, file_type, vendor_file_type;
# ==============================================
# MTK Policy Rule
# ==============================================
# Setup for domain transition
init_daemon_domain(mtk_hal_hdmi)
# Allow to use HWBinder IPC
hwbinder_use(mtk_hal_hdmi);
# Allow a set of permissions required for a domain to be a server which provides a HAL implementation over HWBinder.
hal_server_domain(mtk_hal_hdmi, hal_hdmi)
# add/find permission rule to hwservicemanager
add_hwservice(hal_hdmi_server, mtk_hal_hdmi_hwservice)
# Allow to allocate hidl memory
#hal_client_domain(mtk_hal_hdmi, hal_allocator)
# Purpose : Allow to use kernel driver
allow mtk_hal_hdmi graphics_device:chr_file rw_file_perms;
# Purpose : Allow permission to get AmbientLux from hwservice_manager
allow mtk_hal_hdmi fwk_sensor_hwservice:hwservice_manager find;
#for hdmi uevent
allow mtk_hal_hdmi self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl;
#============= Key Manager HIDL Service ==============
allow mtk_hal_hdmi mtk_hal_keymanage:binder call;
# Purpose : Allow hdmi to call vendor.mediatek.hardware.keymanage@1.0-service.
hal_client_domain(mtk_hal_hdmi, hal_keymaster)
allow mtk_hal_hdmi mtk_hal_keymanage_hwservice:hwservice_manager find;
# Purpose : Allow permission to set hdmi property
set_prop(mtk_hal_hdmi, mtk_hdmi_prop);

View File

@ -317,3 +317,6 @@ type mtk_nvram_ready_prop, property_type, mtk_core_property_type;
#=============allow wifi hotspot to read property===========
type mtk_wifi_hotspot_prop, property_type, mtk_core_property_type;
#=============mtk hdmi property=============
type mtk_hdmi_prop, property_type, mtk_core_property_type;

View File

@ -344,3 +344,6 @@ vendor.mtk.nvram.ready u:object_r:mtk_nvram_ready_prop:s0
#=============Wi-Fi Hotspot==============
wifi.sap.interface u:object_r:mtk_wifi_hotspot_prop:s0
#=============allow mtk hdmi==============#
persist.vendor.sys.hdmi_hidl. u:object_r:mtk_hdmi_prop:s0

View File

@ -39,3 +39,12 @@ allow system_app mtk_hal_mms:binder call;
# Operation : Migration
# Purpose : system_app need vendor_default_prop
get_prop(system_app, vendor_default_prop)
# Date: 2019/07/16
# Operation : Migration
# Purpose : system_app need use hdmi service and create socktet
allow system_app mtk_hal_hdmi_hwservice:hwservice_manager find;
allow system_app mtk_hal_hdmi:binder call;
allow system_app self:netlink_kobject_uevent_socket {read bind create setopt };
# system_app need to read from sysfs /sys/class/switch/hdmi/state
r_dir_file(system_app, sysfs_switch);