sepolicy: Add selinux rules for mtkcodecservice HAL

Change-Id: Ia024bc02b07c45c17475005b4216baa50cee9c13
diff --git a/basic/non_plat/file_contexts b/basic/non_plat/file_contexts
index e3fac82..7e1d513 100644
--- a/basic/non_plat/file_contexts
+++ b/basic/non_plat/file_contexts
@@ -718,6 +718,7 @@
 /(vendor|system/vendor)/bin/hw/android\.hardware\.media\.c2@1\.2-mediatek-64b               u:object_r:mtk_hal_c2_exec:s0
 /(vendor|system/vendor)/bin/hw/android\.hardware\.memtrack-service\.mediatek                u:object_r:mtk_hal_memtrack_exec:s0
 /(vendor|system/vendor)/bin/hw/vendor\.mediatek\.hardware\.gpu@1\.0-service                 u:object_r:mtk_hal_gpu_exec:s0
+/(vendor|system/vendor)/bin/hw/vendor\.mediatek\.hardware\.mtkcodecservice@1\.1-service     u:object_r:hal_mtkcodecservice_default_exec:s0
 
 # Google Trusty system files
 /(vendor|system/vendor)/bin/hw/android\.hardware\.keymaster@3\.0-service\.trusty u:object_r:hal_keymaster_default_exec:s0
diff --git a/basic/non_plat/hal_mtkcodecservice_default.te b/basic/non_plat/hal_mtkcodecservice_default.te
new file mode 100644
index 0000000..2d98cc6
--- /dev/null
+++ b/basic/non_plat/hal_mtkcodecservice_default.te
@@ -0,0 +1,17 @@
+type hal_mtkcodecservice_default, domain;
+type hal_mtkcodecservice_default_exec, exec_type, file_type, vendor_file_type;
+
+init_daemon_domain(hal_mtkcodecservice_default)
+
+hal_server_domain(hal_mtkcodecservice_default, hal_mtkcodecservice)
+
+hal_client_domain(hal_mtkcodecservice_default, hal_allocator)
+
+binder_call(hal_mtkcodecservice_client, hal_mtkcodecservice_server)
+binder_call(hal_mtkcodecservice_server, hal_mtkcodecservice_client)
+
+add_hwservice(hal_mtkcodecservice_server, hal_mtkcodecservice_hwservice)
+allow hal_mtkcodecservice_client hal_mtkcodecservice_hwservice:hwservice_manager find;
+
+allow hal_mtkcodecservice_default hidl_allocator_hwservice:hwservice_manager find;
+allow hal_mtkcodecservice_default hidl_memory_hwservice:hwservice_manager find;
diff --git a/basic/non_plat/hwservice.te b/basic/non_plat/hwservice.te
index 3ea506e..b1318a2 100644
--- a/basic/non_plat/hwservice.te
+++ b/basic/non_plat/hwservice.te
@@ -77,3 +77,4 @@
 
 type mtk_hal_keyinstall_hwservice, hwservice_manager_type;
 type mtk_hal_gpu_hwservice, hwservice_manager_type;
+type hal_mtkcodecservice_hwservice, hwservice_manager_type;
diff --git a/basic/non_plat/hwservice_contexts b/basic/non_plat/hwservice_contexts
index 052bba6..75ccc4a 100644
--- a/basic/non_plat/hwservice_contexts
+++ b/basic/non_plat/hwservice_contexts
@@ -90,3 +90,4 @@
 
 vendor.mediatek.hardware.keyinstall::IKeyinstall u:object_r:mtk_hal_keyinstall_hwservice:s0
 vendor.mediatek.hardware.gpu::IGraphicExt u:object_r:mtk_hal_gpu_hwservice:s0
+vendor.mediatek.hardware.mtkcodecservice::IMtkCodecService u:object_r:hal_mtkcodecservice_hwservice:s0
diff --git a/basic/non_plat/mediacodec.te b/basic/non_plat/mediacodec.te
index ba1cbbc..c32d8da 100644
--- a/basic/non_plat/mediacodec.te
+++ b/basic/non_plat/mediacodec.te
@@ -149,3 +149,5 @@
 get_prop(mediacodec, vendor_mtk_deinterlace_prop)
 get_prop(mediacodec, vendor_mtk_omx_core_prop)
 get_prop(mediacodec, vendor_mtk_hdr_video_prop)
+
+hal_client_domain(mediacodec, hal_mtkcodecservice)
diff --git a/basic/non_plat/mediaserver.te b/basic/non_plat/mediaserver.te
index 1cc0cf4..7a770c7 100644
--- a/basic/non_plat/mediaserver.te
+++ b/basic/non_plat/mediaserver.te
@@ -307,3 +307,5 @@
 hal_client_domain(mediaserver, hal_power)
 
 allow mediaserver vpud_device:chr_file rw_file_perms;
+
+hal_client_domain(mediaserver, hal_mtkcodecservice)
diff --git a/basic/non_plat/system_server.te b/basic/non_plat/system_server.te
index f7b527a..8496364 100644
--- a/basic/non_plat/system_server.te
+++ b/basic/non_plat/system_server.te
@@ -276,3 +276,5 @@
 
 # when anr dump process, SystemServer need send sigal
 allow system_server mtk_hal_pq:process signal;
+
+hal_client_domain(system_server, hal_mtkcodecservice)
diff --git a/basic/plat_public/attributes b/basic/plat_public/attributes
index 4c48837..dfb757f 100644
--- a/basic/plat_public/attributes
+++ b/basic/plat_public/attributes
@@ -111,3 +111,7 @@
 attribute hal_mtk_mmagent;
 attribute hal_mtk_mmagent_client;
 attribute hal_mtk_mmagent_server;
+
+attribute hal_mtkcodecservice;
+attribute hal_mtkcodecservice_client;
+attribute hal_mtkcodecservice_server;