blob: 8a77a9bcaf406a4ffe8983a99b8925011b3a5aaf [file] [log] [blame]
Ravi Kumar Siddojigari125f5482017-12-01 12:51:48 +05301# Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
2#
3# Redistribution and use in source and binary forms, with or without
4# modification, are permitted provided that the following conditions are
5# met:
6# * Redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer.
8# * Redistributions in binary form must reproduce the above
9# copyright notice, this list of conditions and the following
10# disclaimer in the documentation and/or other materials provided
11# with the distribution.
12# * Neither the name of The Linux Foundation nor the names of its
13# contributors may be used to endorse or promote products derived
14# from this software without specific prior written permission.
15#
16# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28type hal-server, domain;
29type hal-server_exec, exec_type, vendor_file_type, file_type;
30
31# need to hw_service
32typeattribute hal-server hal_audio_server;
33typeattribute hal-server hal_sensors_server;
34typeattribute hal-server hal_broadcastradio_server;
35typeattribute hal-server hal_drm_server;
Mahesh Lankad7a0f1d2017-12-05 18:55:08 +053036typeattribute hal-serverĀ  hal_drm;
Ravi Kumar Siddojigari125f5482017-12-01 12:51:48 +053037typeattribute hal-server hal_configstore_client;
38
39init_daemon_domain(hal-server)
40
41############################
42# Common section which is generic
43# needed by most of the domains/services
44#
45vndbinder_use(hal-server)
46use_per_mgr(hal-server)
47hwbinder_use(hal-server)
48
49get_prop(hal-server, hwservicemanager_prop)
50
51#DRM/Audio need this
52r_dir_file(hal-server, firmware_file)
53
54#reading of system_file and execute is already provided via domain.te
55allow hal-server system_file:lnk_file r_file_perms;
56
57# Read access to pseudo filesystems
58allow hal-server cgroup:dir create_dir_perms;
59allow hal-server cgroup:file rw_file_perms;
60r_dir_file(hal-server, system_file)
61
62##########################
63# Audio services
64#
65
66# Allow hal-server to read soundcard state under /proc/asound
67r_dir_file(hal-server, proc_audiod)
68
69# Need this for reading of /proc/asound/cards
70# hal_audio (/system/sepolicy has this) looks like this
71# is genric node .
72r_dir_file(hal-server, proc)
73
74allow hal-server audio_data_file:dir rw_dir_perms;
75allow hal-server audio_data_file:file create_file_perms;
76
77#r_dir_file(hal_audio, proc)
78allow hal-server audio_device:dir r_dir_perms;
79allow hal-server audio_device:chr_file rw_file_perms;
80
81#Set scheduling info for apps ( picked for system_server public file)
82allow system_server hal-server:process { getsched setsched };
83
84# Allow hal_audio_default to read sysfs_thermal dir/files for speaker protection
85r_dir_file(hal-server, sysfs_thermal)
86
87#Allow hal audio to use Binder IPC
88
89userdebug_or_eng(`
90 diag_use(hal-server)
91 #Allow access to debug fs
92 allow hal-server debugfs:dir r_dir_perms;
93 allow hal-server qti_debugfs:dir r_dir_perms;
94 allow hal-server qti_debugfs:file rw_file_perms;
95')
96
97#Split A2dp specific
98binder_call(hal-server,bluetooth)
99
100#for perf hal call
101hal_client_domain(hal-server, hal_perf)
102#allow acess to wcd_cpe
103allow hal-server sysfs_audio:file rw_file_perms;
104allow hal-server sysfs_audio:dir r_dir_perms;
Ramjee Singh5e921462017-12-12 20:35:23 +0530105#allow access to adsp boot for peripheral manager
106allow hal-server sysfs_boot:file w_file_perms ;
Ravi Kumar Siddojigari125f5482017-12-01 12:51:48 +0530107
108##########################
109# sensors services
110#
111allow hal-server hidl_base_hwservice:hwservice_manager add;
112allow hal-server sysfs_sensors:dir r_dir_perms;
113allow hal-server sysfs_sensors:file rw_file_perms;
114allow hal-server sysfs_sensors:lnk_file read;
115allow hal-server input_device:dir r_dir_perms;
116allow hal-server input_device:chr_file r_file_perms;
117allow hal-server persist_file:dir search;
118
119##########################
120# DRM services
121#
122# Required by Widevine DRM (b/22990512)
123allow hal-server self:process execmem;
124
125# Read files already opened under /data
126allow hal-server system_data_file:dir { search getattr };
127allow hal-server system_data_file:file { getattr read };
128allow hal-server system_data_file:lnk_file r_file_perms;
129
130# Allow access to ion memory allocation device
131allow hal-server ion_device:chr_file rw_file_perms;
132allow hal-server hal_graphics_allocator:fd use;
Divya Narayanan Poojary22ce1702017-12-28 14:43:39 +0530133allow hal-server hal_allocator:fd use;
Ravi Kumar Siddojigari125f5482017-12-01 12:51:48 +0530134
135# Allow access to fds allocated by mediaserver
136allow hal-server mediaserver:fd use;
137
138# Allow access to app_data and media_data_files
139allow hal-server media_data_file:dir create_dir_perms;
140allow hal-server media_data_file:file create_file_perms;
141
142allow hal-server sysfs:file r_file_perms;
143
Mahesh Lankad7a0f1d2017-12-05 18:55:08 +0530144allow hal-server serialno_prop:file read;
145allow hal-server untrusted_app_25:fd use;
146
Ravi Kumar Siddojigari125f5482017-12-01 12:51:48 +0530147##########################
148# Config Store
149#
150#TODO: Need to clean this up later
151allow hal_graphics_composer_default sysfs:file r_file_perms;
152
153binder_call(hal_configstore_server, hal-server)
154binder_call(hal_sensors_server, hal-server)
155binder_call(hal_drm_default, hal-server)
156binder_call(hal_audio_server, hal-server)
157binder_call(hal-server, hal_audio_server)
158
159##############
160# for add_hwservice replacement
161#
162allow hal-server hal_configstore_ISurfaceFlingerConfigs:hwservice_manager find;
163allow hal-server hal_sensors_hwservice:hwservice_manager find;
164allow hal-server hal_audio_hwservice:hwservice_manager find;
165allow hal-server hal_drm_hwservice:hwservice_manager find;
166allow hal_sensors_default hidl_base_hwservice:hwservice_manager add;