Vadim Caen | d64cf75 | 2022-11-04 12:51:18 +0000 | [diff] [blame] | 1 | # virtual_camera - virtual camera daemon |
| 2 | |
Priyanka Advani (xWF) | 639c441 | 2024-08-05 17:09:50 +0000 | [diff] [blame] | 3 | type virtual_camera, domain, coredomain; |
| 4 | type virtual_camera_exec, system_file_type, exec_type, file_type; |
Vadim Caen | d64cf75 | 2022-11-04 12:51:18 +0000 | [diff] [blame] | 5 | |
Vadim Caen | f6e88ec | 2023-09-29 16:15:23 +0200 | [diff] [blame] | 6 | init_daemon_domain(virtual_camera) |
Vadim Caen | d64cf75 | 2022-11-04 12:51:18 +0000 | [diff] [blame] | 7 | |
Vadim Caen | f6e88ec | 2023-09-29 16:15:23 +0200 | [diff] [blame] | 8 | # Since virtual_camera is not a real HAL we don't set the |
| 9 | # hal_server_domain(virtual_camera, hal_camera) macro but only the rules that |
| 10 | # we actually need from halserverdomain and hal_camera_server: |
| 11 | binder_use(virtual_camera) |
Ján Sebechlebský | 5d6b66c | 2023-11-20 09:39:22 +0000 | [diff] [blame] | 12 | binder_call(virtual_camera, cameraserver) |
| 13 | binder_call(virtual_camera, system_server) |
Vadim Caen | d64cf75 | 2022-11-04 12:51:18 +0000 | [diff] [blame] | 14 | |
Jan Sebechlebsky | 0fd6d1b | 2023-12-27 17:26:52 +0100 | [diff] [blame] | 15 | # Allow virtual_camera to communicate with |
| 16 | # mediaserver (required for using Surface originating |
| 17 | # from virtual camera in mediaserver). |
| 18 | binder_call(virtual_camera, mediaserver) |
| 19 | |
| 20 | # Required for the codecs to be able to decode |
| 21 | # video into surface provided by virtual camera. |
| 22 | hal_client_domain(virtual_camera, hal_codec2) |
| 23 | hal_client_domain(virtual_camera, hal_omx) |
Jan Sebechlebsky | 6e1795c | 2023-12-06 09:31:17 +0100 | [diff] [blame] | 24 | |
| 25 | # Allow virtualCamera to call apps via binder. |
| 26 | binder_call(virtual_camera, appdomain) |
| 27 | |
Vadim Caen | f6e88ec | 2023-09-29 16:15:23 +0200 | [diff] [blame] | 28 | # Allow virtual_camera to use fd from apps |
| 29 | allow virtual_camera { appdomain -isolated_app }:fd use; |
Vadim Caen | d64cf75 | 2022-11-04 12:51:18 +0000 | [diff] [blame] | 30 | |
Rohit | d5f1d0d | 2024-09-27 01:54:49 -0700 | [diff] [blame] | 31 | binder_call(virtual_camera, surfaceflinger); |
Vadim Caen | 68dc59d | 2024-03-15 17:12:37 +0100 | [diff] [blame] | 32 | |
Vadim Caen | f6e88ec | 2023-09-29 16:15:23 +0200 | [diff] [blame] | 33 | # Only allow virtual_camera to add a virtual_camera_service and no one else. |
| 34 | add_service(virtual_camera, virtual_camera_service); |
| 35 | |
| 36 | # Allow virtual_camera to map graphic buffers |
| 37 | hal_client_domain(virtual_camera, hal_graphics_allocator) |
Jan Sebechlebsky | 267b6a9 | 2023-11-17 10:08:16 +0100 | [diff] [blame] | 38 | |
| 39 | # Allow virtual_camera to use GPU |
| 40 | allow virtual_camera gpu_device:chr_file rw_file_perms; |
| 41 | allow virtual_camera gpu_device:dir r_dir_perms; |
Inseob Kim | fe3a27a | 2024-09-10 15:11:45 +0900 | [diff] [blame] | 42 | r_dir_file(virtual_camera, sysfs_gpu) |
Jan Sebechlebsky | de64417 | 2023-11-30 10:57:16 +0100 | [diff] [blame] | 43 | |
Jan Sebechlebsky | fd7e285 | 2024-02-26 11:55:16 +0100 | [diff] [blame] | 44 | # Allow virtual camera to use graphics composer fd-s (fences). |
| 45 | allow virtual_camera hal_graphics_composer:fd use; |
| 46 | |
Jan Sebechlebsky | de64417 | 2023-11-30 10:57:16 +0100 | [diff] [blame] | 47 | # For collecting bugreports. |
| 48 | allow virtual_camera dumpstate:fd use; |
| 49 | allow virtual_camera dumpstate:fifo_file write; |
Jan Sebechlebsky | 0959bef | 2023-12-05 14:17:07 +0100 | [diff] [blame] | 50 | |
| 51 | # Needed for permission checks. |
| 52 | allow virtual_camera permission_service:service_manager find; |
Jan Sebechlebsky | 7f271ce | 2024-04-15 08:25:19 +0000 | [diff] [blame] | 53 | |
| 54 | # Allow 'adb shell cmd' to configure test instances of camera. |
| 55 | allow virtual_camera adbd:fd use; |
| 56 | allow virtual_camera adbd:unix_stream_socket { getattr read write }; |
| 57 | allow virtual_camera shell:fifo_file { getattr read write }; |