| # Copyright (c) 2015-2017, 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 hal-server, domain; |
| type hal-server_exec, exec_type, vendor_file_type, file_type; |
| |
| # need to hw_service |
| typeattribute hal-server hal_audio_server; |
| typeattribute hal-server hal_sensors_server; |
| typeattribute hal-server hal_broadcastradio_server; |
| typeattribute hal-server hal_drm_server; |
| typeattribute hal-serverĀ hal_drm; |
| typeattribute hal-server hal_configstore_client; |
| |
| init_daemon_domain(hal-server) |
| |
| ############################ |
| # Common section which is generic |
| # needed by most of the domains/services |
| # |
| vndbinder_use(hal-server) |
| use_per_mgr(hal-server) |
| hwbinder_use(hal-server) |
| |
| get_prop(hal-server, hwservicemanager_prop) |
| |
| #DRM/Audio need this |
| r_dir_file(hal-server, firmware_file) |
| |
| #reading of system_file and execute is already provided via domain.te |
| allow hal-server system_file:lnk_file r_file_perms; |
| |
| # Read access to pseudo filesystems |
| allow hal-server cgroup:dir create_dir_perms; |
| allow hal-server cgroup:file rw_file_perms; |
| r_dir_file(hal-server, system_file) |
| |
| ########################## |
| # Audio services |
| # |
| |
| # Allow hal-server to read soundcard state under /proc/asound |
| r_dir_file(hal-server, proc_audiod) |
| |
| # Need this for reading of /proc/asound/cards |
| # hal_audio (/system/sepolicy has this) looks like this |
| # is genric node . |
| r_dir_file(hal-server, proc) |
| |
| allow hal-server audio_data_file:dir rw_dir_perms; |
| allow hal-server audio_data_file:file create_file_perms; |
| |
| #r_dir_file(hal_audio, proc) |
| allow hal-server audio_device:dir r_dir_perms; |
| allow hal-server audio_device:chr_file rw_file_perms; |
| |
| #Set scheduling info for apps ( picked for system_server public file) |
| allow system_server hal-server:process { getsched setsched }; |
| |
| # Allow hal_audio_default to read sysfs_thermal dir/files for speaker protection |
| r_dir_file(hal-server, sysfs_thermal) |
| |
| #Allow hal audio to use Binder IPC |
| |
| userdebug_or_eng(` |
| diag_use(hal-server) |
| #Allow access to debug fs |
| allow hal-server debugfs:dir r_dir_perms; |
| allow hal-server qti_debugfs:dir r_dir_perms; |
| allow hal-server qti_debugfs:file rw_file_perms; |
| ') |
| |
| #Split A2dp specific |
| binder_call(hal-server,bluetooth) |
| |
| #for perf hal call |
| hal_client_domain(hal-server, hal_perf) |
| #allow acess to wcd_cpe |
| allow hal-server sysfs_audio:file rw_file_perms; |
| allow hal-server sysfs_audio:dir r_dir_perms; |
| #allow access to adsp boot for peripheral manager |
| allow hal-server sysfs_boot:file w_file_perms ; |
| |
| ########################## |
| # sensors services |
| # |
| allow hal-server hidl_base_hwservice:hwservice_manager add; |
| allow hal-server sysfs_sensors:dir r_dir_perms; |
| allow hal-server sysfs_sensors:file rw_file_perms; |
| allow hal-server sysfs_sensors:lnk_file read; |
| allow hal-server input_device:dir r_dir_perms; |
| allow hal-server input_device:chr_file r_file_perms; |
| allow hal-server persist_file:dir search; |
| |
| ########################## |
| # DRM services |
| # |
| # Required by Widevine DRM (b/22990512) |
| allow hal-server self:process execmem; |
| |
| # Read files already opened under /data |
| allow hal-server system_data_file:dir { search getattr }; |
| allow hal-server system_data_file:file { getattr read }; |
| allow hal-server system_data_file:lnk_file r_file_perms; |
| |
| # Allow access to ion memory allocation device |
| allow hal-server ion_device:chr_file rw_file_perms; |
| allow hal-server hal_graphics_allocator:fd use; |
| allow hal-server hal_allocator:fd use; |
| |
| # Allow access to fds allocated by mediaserver |
| allow hal-server mediaserver:fd use; |
| |
| # Allow access to app_data and media_data_files |
| allow hal-server media_data_file:dir create_dir_perms; |
| allow hal-server media_data_file:file create_file_perms; |
| |
| allow hal-server sysfs:file r_file_perms; |
| |
| allow hal-server serialno_prop:file read; |
| allow hal-server untrusted_app_25:fd use; |
| |
| ########################## |
| # Config Store |
| # |
| #TODO: Need to clean this up later |
| allow hal_graphics_composer_default sysfs:file r_file_perms; |
| |
| binder_call(hal_configstore_server, hal-server) |
| binder_call(hal_sensors_server, hal-server) |
| binder_call(hal_drm_default, hal-server) |
| binder_call(hal_audio_server, hal-server) |
| binder_call(hal-server, hal_audio_server) |
| |
| ############## |
| # for add_hwservice replacement |
| # |
| allow hal-server hal_configstore_ISurfaceFlingerConfigs:hwservice_manager find; |
| allow hal-server hal_sensors_hwservice:hwservice_manager find; |
| allow hal-server hal_audio_hwservice:hwservice_manager find; |
| allow hal-server hal_drm_hwservice:hwservice_manager find; |
| allow hal_sensors_default hidl_base_hwservice:hwservice_manager add; |