blob: a0fb3d8187544a3f79709917c3e6352807b50f7b [file] [log] [blame]
Vadim Caend64cf752022-11-04 12:51:18 +00001# virtual_camera - virtual camera daemon
2
Vadim Caen8d610ba2024-08-02 14:25:24 +02003# types defined in system/sepolicy/public
Vadim Caend64cf752022-11-04 12:51:18 +00004
Vadim Caenf6e88ec2023-09-29 16:15:23 +02005init_daemon_domain(virtual_camera)
Vadim Caend64cf752022-11-04 12:51:18 +00006
Vadim Caenf6e88ec2023-09-29 16:15:23 +02007# Since virtual_camera is not a real HAL we don't set the
8# hal_server_domain(virtual_camera, hal_camera) macro but only the rules that
9# we actually need from halserverdomain and hal_camera_server:
10binder_use(virtual_camera)
Ján Sebechlebský5d6b66c2023-11-20 09:39:22 +000011binder_call(virtual_camera, cameraserver)
12binder_call(virtual_camera, system_server)
Vadim Caend64cf752022-11-04 12:51:18 +000013
Jan Sebechlebsky0fd6d1b2023-12-27 17:26:52 +010014# Allow virtual_camera to communicate with
15# mediaserver (required for using Surface originating
16# from virtual camera in mediaserver).
17binder_call(virtual_camera, mediaserver)
18
19# Required for the codecs to be able to decode
20# video into surface provided by virtual camera.
21hal_client_domain(virtual_camera, hal_codec2)
22hal_client_domain(virtual_camera, hal_omx)
Jan Sebechlebsky6e1795c2023-12-06 09:31:17 +010023
24# Allow virtualCamera to call apps via binder.
25binder_call(virtual_camera, appdomain)
26
Vadim Caenf6e88ec2023-09-29 16:15:23 +020027# Allow virtual_camera to use fd from apps
28allow virtual_camera { appdomain -isolated_app }:fd use;
Vadim Caend64cf752022-11-04 12:51:18 +000029
Vadim Caen68dc59d2024-03-15 17:12:37 +010030# Allow virtual_camera to use fd from surface flinger
31allow virtual_camera surfaceflinger:fd use;
Vadim Caen4eb4ac12024-07-23 16:39:54 +020032allow virtual_camera surfaceflinger:binder call;
Vadim Caen68dc59d2024-03-15 17:12:37 +010033
Vadim Caenf6e88ec2023-09-29 16:15:23 +020034# Only allow virtual_camera to add a virtual_camera_service and no one else.
35add_service(virtual_camera, virtual_camera_service);
36
37# Allow virtual_camera to map graphic buffers
38hal_client_domain(virtual_camera, hal_graphics_allocator)
Jan Sebechlebsky267b6a92023-11-17 10:08:16 +010039
40# Allow virtual_camera to use GPU
41allow virtual_camera gpu_device:chr_file rw_file_perms;
42allow virtual_camera gpu_device:dir r_dir_perms;
Jan Sebechlebsky9999b0a2024-06-13 14:23:22 +000043allow virtual_camera sysfs_gpu:file r_file_perms;
Jan Sebechlebskyde644172023-11-30 10:57:16 +010044
Jan Sebechlebskyfd7e2852024-02-26 11:55:16 +010045# Allow virtual camera to use graphics composer fd-s (fences).
46allow virtual_camera hal_graphics_composer:fd use;
47
Jan Sebechlebskyde644172023-11-30 10:57:16 +010048# For collecting bugreports.
49allow virtual_camera dumpstate:fd use;
50allow virtual_camera dumpstate:fifo_file write;
Jan Sebechlebsky0959bef2023-12-05 14:17:07 +010051
52# Needed for permission checks.
53allow virtual_camera permission_service:service_manager find;
Jan Sebechlebsky7f271ce2024-04-15 08:25:19 +000054
55# Allow 'adb shell cmd' to configure test instances of camera.
56allow virtual_camera adbd:fd use;
57allow virtual_camera adbd:unix_stream_socket { getattr read write };
58allow virtual_camera shell:fifo_file { getattr read write };