Alex Klyubin | ac2b4cd | 2017-02-13 14:40:49 -0800 | [diff] [blame] | 1 | # HwBinder IPC from client to server, and callbacks |
| 2 | binder_call(hal_audio_client, hal_audio_server) |
| 3 | binder_call(hal_audio_server, hal_audio_client) |
| 4 | |
Alex Klyubin | 53656c1 | 2017-04-13 19:05:27 -0700 | [diff] [blame^] | 5 | add_hwservice(hal_audio_server, hal_audio_hwservice) |
| 6 | allow hal_audio_client hal_audio_hwservice:hwservice_manager find; |
| 7 | |
Jeff Vander Stoep | 27ae545 | 2016-10-25 12:42:39 -0700 | [diff] [blame] | 8 | allow hal_audio ion_device:chr_file r_file_perms; |
| 9 | |
Jeff Vander Stoep | 27ae545 | 2016-10-25 12:42:39 -0700 | [diff] [blame] | 10 | userdebug_or_eng(` |
| 11 | # used for pcm capture for debug. |
| 12 | allow hal_audio audiohal_data_file:dir create_dir_perms; |
| 13 | allow hal_audio audiohal_data_file:file create_file_perms; |
| 14 | ') |
| 15 | |
| 16 | r_dir_file(hal_audio, proc) |
| 17 | allow hal_audio audio_device:dir r_dir_perms; |
| 18 | allow hal_audio audio_device:chr_file rw_file_perms; |
| 19 | |
Mikhail Naganov | d7c88dd | 2017-03-09 14:32:16 -0800 | [diff] [blame] | 20 | # Needed to provide debug dump output via dumpsys' pipes. |
| 21 | allow hal_audio shell:fd use; |
| 22 | allow hal_audio shell:fifo_file write; |
| 23 | |
Jeff Vander Stoep | 27ae545 | 2016-10-25 12:42:39 -0700 | [diff] [blame] | 24 | # Needed on some devices for playing audio on paired BT device, |
| 25 | # but seems appropriate for all devices. |
| 26 | unix_socket_connect(hal_audio, bluetooth, bluetooth) |
| 27 | |
| 28 | ### |
| 29 | ### neverallow rules |
| 30 | ### |
| 31 | |
Alex Klyubin | ac2b4cd | 2017-02-13 14:40:49 -0800 | [diff] [blame] | 32 | # Should never execute any executable without a domain transition |
Jeff Vander Stoep | 27ae545 | 2016-10-25 12:42:39 -0700 | [diff] [blame] | 33 | neverallow hal_audio { file_type fs_type }:file execute_no_trans; |
| 34 | |
Alex Klyubin | ac2b4cd | 2017-02-13 14:40:49 -0800 | [diff] [blame] | 35 | # Should never need network access. |
Jeff Vander Stoep | 27ae545 | 2016-10-25 12:42:39 -0700 | [diff] [blame] | 36 | # Disallow network sockets. |
| 37 | neverallow hal_audio domain:{ tcp_socket udp_socket rawip_socket } *; |
Jeff Vander Stoep | 7fa59c8 | 2017-03-13 22:03:10 -0700 | [diff] [blame] | 38 | |
| 39 | # Only audio HAL may directly access the audio hardware |
| 40 | neverallow { halserverdomain -hal_audio_server } audio_device:chr_file *; |