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