| # Copyright (c) 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 mm-pp-daemon, domain; |
| type mm-pp-daemon_exec, exec_type, vendor_file_type, file_type; |
| |
| init_daemon_domain(mm-pp-daemon) |
| |
| #Need to use fb ioctls to communicate with kernel |
| allow mm-pp-daemon graphics_device:chr_file rw_file_perms; |
| allow mm-pp-daemon graphics_device:dir r_dir_perms; |
| |
| # Allow reading/writing to '/persist/display/*' |
| # The color config file is dynamically created |
| allow mm-pp-daemon persist_display_file:dir rw_dir_perms; |
| allow mm-pp-daemon persist_display_file:file create_file_perms; |
| |
| # Allow for directory search only to '/persist' |
| allow mm-pp-daemon mnt_vendor_file:dir search; |
| |
| # Allow reading/writing data config files |
| allow mm-pp-daemon display_vendor_data_file:dir create_dir_perms; |
| allow mm-pp-daemon display_vendor_data_file:file create_file_perms; |
| |
| # Allow read to sensor device and read/write to sensor socket |
| allow mm-pp-daemon sensors_device:chr_file r_file_perms; |
| allow mm-pp-daemon sensors_socket:sock_file rw_file_perms; |
| allow mm-pp-daemon sensors:unix_stream_socket connectto; |
| |
| # Allow read to display vendor properties |
| get_prop(mm-pp-daemon, vendor_display_prop) |
| |
| # Rule for IPC communication |
| allow mm-pp-daemon qdisplay_service:service_manager find; |
| vndbinder_use(mm-pp-daemon) |
| hal_client_domain(mm-pp-daemon, hal_graphics_composer) |
| allow mm-pp-daemon fwk_sensor_hwservice:hwservice_manager find; |
| # Allow service manager to find surface flinger service, |
| # sensorservice service, permission_service, and power service (for |
| # acquire wakelock) |
| #allow mm-pp-daemon { surfaceflinger_service sensorservice_service |
| # permission_service power_service }:service_manager find; |
| # Allow mm-pp-daemon to call binder for screen refresh |
| #binder_use(mm-pp-daemon) |
| binder_call(mm-pp-daemon, system_server) |
| |
| userdebug_or_eng(` |
| # This allows pp-daemon to use shell commands to blank |
| # the display - it uses input keyevent to do this |
| allow mm-pp-daemon { vendor_shell_exec |
| #zygote_exec |
| }:file rx_file_perms; |
| allow mm-pp-daemon self:process ptrace; |
| |
| |
| # This allow pp-daemon access to diag |
| diag_use(mm-pp-daemon) |
| ') |
| |
| # Allow mm-pp-daemon to change the brightness |
| allow mm-pp-daemon sysfs_leds:dir r_dir_perms; |
| allow mm-pp-daemon sysfs_leds:file rw_file_perms; |
| allow mm-pp-daemon sysfs_leds:lnk_file read; |
| allow mm-pp-daemon sysfs_graphics:dir r_dir_perms; |
| allow mm-pp-daemon sysfs_graphics:file rw_file_perms; |
| allow mm-pp-daemon sysfs_data:file r_file_perms; |
| |
| # Allow socket calls in pp-daemon |
| unix_socket_connect(mm-pp-daemon, pps, init) |
| |
| allow mm-pp-daemon init:unix_stream_socket { listen accept }; |
| |
| # Allow connections between sensor manager and mm-pp-daemon |
| #allow mm-pp-daemon system_server:unix_stream_socket rw_socket_perms; |
| |
| # access lcd-backlight |
| r_dir_file(mm-pp-daemon, sysfs_leds) |