Sepolicy: Add power off alarm rules

Add power off alarm rules

Change-Id: I02b59aa2c34efc4b57810e592ca2750a511155f0
CRs-Fixed: 2399628
This commit is contained in:
Qimeng Pan
2019-02-18 15:14:19 +08:00
committed by Gerrit - the friendly Code Review server
parent 959bd02417
commit edf74ef256
8 changed files with 139 additions and 6 deletions

3
generic/vendor/common/file.te vendored Normal file → Executable file
View File

@@ -1,4 +1,4 @@
# Copyright (c) 2018, The Linux Foundation. All rights reserved.
# Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@@ -111,6 +111,7 @@ type persist_sensors_file, file_type, vendor_persist_type;
type persist_time_file, file_type, vendor_persist_type;
type persist_audio_file, file_type, vendor_persist_type;
type persist_bluetooth_file, file_type, vendor_persist_type;
type persist_alarm_file, file_type, vendor_persist_type;
type netmgr_data_file, file_type, data_file_type;
type netmgr_recovery_data_file, file_type, data_file_type;

7
generic/vendor/common/file_contexts vendored Normal file → Executable file
View File

@@ -1,4 +1,4 @@
# Copyright (c) 2018, The Linux Foundation. All rights reserved.
# Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@@ -165,6 +165,9 @@
/(vendor|system/vendor)/bin/hw/vendor\.qti\.hardware\.qdutils_disp@1\.0-service-qti u:object_r:hal_qdutils_disp_qti_exec:s0
/(vendor|system/vendor)/bin/hw/vendor\.qti\.hardware\.perf@1\.0-service u:object_r:hal_perf_default_exec:s0
/(vendor|system/vendor)/bin/hw/vendor\.qti\.hardware\.capabilityconfigstore@1\.0-service u:object_r:hal_capabilityconfigstore_qti_default_exec:s0
/(vendor|system/vendor)/bin/power_off_alarm u:object_r:power_off_alarm_exec:s0
/vendor/bin/hw/vendor\.display\.color@1\.0-service u:object_r:hal_display_color_default_exec:s0
/vendor/bin/hw/vendor\.qti\.media\.c2@1\.0-service u:object_r:mediacodec_exec:s0
/vendor/bin/hw/hardware\.google\.media\.c2@1\.0-service-software u:object_r:mediacodec_exec:s0
@@ -293,6 +296,8 @@
#persist_bluetooth_file
/mnt/vendor/persist/bluetooth(/.*)? u:object_r:persist_bluetooth_file:s0
#power off alarm file
/mnt/vendor/persist/alarm(/.*)? u:object_r:persist_alarm_file:s0
/(vendor|system/vendor)/bin/hbtp_daemon u:object_r:hbtp_exec:s0
/(vendor|system/vendor)/bin/sscrpcd u:object_r:sensors_exec:s0

34
generic/vendor/common/hal_alarm_qti.te vendored Executable file
View File

@@ -0,0 +1,34 @@
# Copyright (c) 2017, 2019 The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of The Linux Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
binder_call(hal_alarm_qti_client, hal_alarm_qti_server)
binder_call(hal_alarm_qti_server, hal_alarm_qti_client)
add_hwservice(hal_alarm_qti_server, hal_alarm_qti_hwservice)
allow hal_alarm_qti_client hal_alarm_qti_hwservice:hwservice_manager find;

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
# Copyright (c) 2017, 2019 The Linux Foundation. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@@ -26,10 +26,11 @@
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
type hal_alarm_qti_default, domain;
hal_server_domain(hal_alarm_qti_default, hal_alarm_qti)
type hal_alarm_qti_default_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(hal_alarm_qti_default)
add_hwservice(hal_alarm_qti_server, hal_alarm_qti_hwservice)
allow hal_alarm_qti_client hal_alarm_qti_hwservice:hwservice_manager find;
init_daemon_domain(hal_alarm_qti_default)
allow hal_alarm_qti_default rtc_device:chr_file r_file_perms;

1
generic/vendor/common/init_shell.te vendored Normal file → Executable file
View File

@@ -76,6 +76,7 @@ set_prop(qti_init_shell, ipacm_prop)
set_prop(qti_init_shell, msm_irqbalance_prop)
set_prop(qti_init_shell, vendor_dataqti_prop)
set_prop(qti_init_shell, vendor_display_prop)
set_prop(qti_init_shell, vendor_alarm_boot_prop)
set_prop(qti_init_shell, vendor_gralloc_prop)
set_prop(qti_init_shell, vendor_usb_prop)
set_prop(qti_init_shell, vendor_system_prop)

38
generic/vendor/common/power_off_alarm.te vendored Executable file
View File

@@ -0,0 +1,38 @@
# Copyright (c) 2017-2019 Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of The Linux Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
type power_off_alarm, domain;
type power_off_alarm_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(power_off_alarm)
allow power_off_alarm rtc_device:chr_file r_file_perms;
allow power_off_alarm kmsg_device:chr_file w_file_perms;
allow power_off_alarm self:capability2 wake_alarm;
set_prop(power_off_alarm, powerctl_prop)

50
generic/vendor/common/poweroffalarm_app.te vendored Executable file
View File

@@ -0,0 +1,50 @@
# Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of The Linux Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
type poweroffalarm_app, domain;
app_domain(poweroffalarm_app);
allow poweroffalarm_app app_api_service:service_manager find;
allow poweroffalarm_app mnt_vendor_file:dir r_dir_perms;
allow poweroffalarm_app persist_alarm_file:dir rw_dir_perms;
allow poweroffalarm_app persist_alarm_file:file create_file_perms;
hal_client_domain(poweroffalarm_app, hal_alarm_qti);
binder_call(poweroffalarm_app, hal_alarm_qti_default);
allow poweroffalarm_app system_app_data_file:dir create_dir_perms;
#allow poweroffalarm_app system_app_data_file:{ file lnk_file } create_file_perms;
allow poweroffalarm_app surfaceflinger_service:service_manager find;
allow poweroffalarm_app audioserver_service:service_manager find;
allow poweroffalarm_app mediaserver_service:service_manager find;
get_prop(poweroffalarm_app, vendor_alarm_boot_prop);
#get_prop(poweroffalarm_app, vendor_iop_prop)

3
generic/vendor/common/seapp_contexts vendored Normal file → Executable file
View File

@@ -35,3 +35,6 @@ user=_app seinfo=platform name=com.qualcomm.telephony domain=qtelephony type=app
#add new domain for qtidataservices
user=radio seinfo=platform name=.qtidataservices domain=qtidataservices_app type=radio_data_file
#Add new domain for power off alarm app
user=system seinfo=platform name=com.qualcomm.qti.poweroffalarm domain=poweroffalarm_app type=system_app_data_file