From ae6fbad5e9100db53545a4af8d9eeedb878ac951 Mon Sep 17 00:00:00 2001 From: "otis.huang" Date: Sat, 18 Jan 2020 10:20:04 +0800 Subject: [PATCH] [ALPS04387792] BGService: add sepolicy permission [Detail] 1. add BGService sepolicy permission MTK-Commit-Id: f5832af535feb84ff9f94ae25eb02fc6f5959762 Change-Id: I22a1e8d6e17a2f455771adf677d2ce8cb32e6550 CR-Id: ALPS04387792 Feature: [Android Default] Camera Application Basic Functions --- non_plat/attributes | 8 ++++++++ non_plat/hwservice.te | 4 ++++ non_plat/hwservice_contexts | 2 +- non_plat/mtk_hal_bgs.te | 6 ++++++ non_plat/mtk_hal_camera.te | 2 ++ non_plat/platform_app.te | 4 ++++ r_non_plat/hwservice_contexts | 2 +- 7 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 non_plat/mtk_hal_bgs.te diff --git a/non_plat/attributes b/non_plat/attributes index 344d60d..e00aa73 100644 --- a/non_plat/attributes +++ b/non_plat/attributes @@ -80,3 +80,11 @@ attribute mtk_hal_md_dbfilter_server; attribute hal_hdmi; attribute hal_hdmi_client; attribute hal_hdmi_server; + +# Date: 2019/09/06 +# BGService HIDL +attribute mtk_hal_bgs; +attribute mtk_hal_bgs_client; +attribute mtk_hal_bgs_server; + + diff --git a/non_plat/hwservice.te b/non_plat/hwservice.te index 298fa79..6a7304a 100644 --- a/non_plat/hwservice.te +++ b/non_plat/hwservice.te @@ -57,3 +57,7 @@ type mtk_hal_md_dbfilter_hwservice, hwservice_manager_type; # Date: 2019/07/16 # HDMI HIDL type mtk_hal_hdmi_hwservice, hwservice_manager_type; + +# Date: 2019/09/06 +# BGService HIDL +type mtk_hal_bgs_hwservice, hwservice_manager_type; diff --git a/non_plat/hwservice_contexts b/non_plat/hwservice_contexts index 67e965a..3991a9f 100644 --- a/non_plat/hwservice_contexts +++ b/non_plat/hwservice_contexts @@ -62,7 +62,7 @@ vendor.mediatek.hardware.modemdbfilter::ICopyDBFilter u:object_r:mtk_hal_md_dbfi # Date: 2019/07/04 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 +vendor.mediatek.hardware.camera.bgservice::IBGService u:object_r:mtk_hal_bgs_hwservice:s0 # Date : 2019/07/16 # HDMI HIDL diff --git a/non_plat/mtk_hal_bgs.te b/non_plat/mtk_hal_bgs.te new file mode 100644 index 0000000..c93342f --- /dev/null +++ b/non_plat/mtk_hal_bgs.te @@ -0,0 +1,6 @@ +# HwBinder IPC from client to server, and callbacks +binder_call(mtk_hal_bgs_client, mtk_hal_bgs_server) +binder_call(mtk_hal_bgs_server, mtk_hal_bgs_client) + +add_hwservice(mtk_hal_bgs_server, mtk_hal_bgs_hwservice) +allow mtk_hal_bgs_client mtk_hal_bgs_hwservice:hwservice_manager find; \ No newline at end of file diff --git a/non_plat/mtk_hal_camera.te b/non_plat/mtk_hal_camera.te index 82ceb18..db30551 100644 --- a/non_plat/mtk_hal_camera.te +++ b/non_plat/mtk_hal_camera.te @@ -23,6 +23,8 @@ init_daemon_domain(mtk_hal_camera) # HAL implementation of the specified type over HwBinder. hal_server_domain(mtk_hal_camera, hal_camera) +hal_server_domain(mtk_hal_camera, mtk_hal_bgs) + # Allow camerahalserver to use HwBinder and vendor binder IPC. hwbinder_use(mtk_hal_camera) vndbinder_use(mtk_hal_camera) diff --git a/non_plat/platform_app.te b/non_plat/platform_app.te index 1fe51aa..33178e0 100644 --- a/non_plat/platform_app.te +++ b/non_plat/platform_app.te @@ -119,5 +119,9 @@ allow platform_app sw_sync_device:chr_file rw_file_perms; # Date: 2019/07/04 # Purpose: Allow platform app to use BGService HIDL and access mtk_hal_camera +hal_client_domain(platform_app, mtk_hal_bgs) +allow platform_app mtk_hal_bgs_hwservice:hwservice_manager find; +binder_call(platform_app, mtk_hal_bgs) +binder_call(mtk_hal_bgs, platform_app) binder_call(platform_app, mtk_hal_camera) binder_call(mtk_hal_camera, platform_app) diff --git a/r_non_plat/hwservice_contexts b/r_non_plat/hwservice_contexts index 67e965a..3991a9f 100644 --- a/r_non_plat/hwservice_contexts +++ b/r_non_plat/hwservice_contexts @@ -62,7 +62,7 @@ vendor.mediatek.hardware.modemdbfilter::ICopyDBFilter u:object_r:mtk_hal_md_dbfi # Date: 2019/07/04 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 +vendor.mediatek.hardware.camera.bgservice::IBGService u:object_r:mtk_hal_bgs_hwservice:s0 # Date : 2019/07/16 # HDMI HIDL