xref: /aosp_15_r20/system/sepolicy/private/hal_camera.te (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
1*e4a36f41SAndroid Build Coastguard Worker# HwBinder IPC from clients to server and callbacks
2*e4a36f41SAndroid Build Coastguard Workerbinder_call(hal_camera_client, hal_camera_server)
3*e4a36f41SAndroid Build Coastguard Workerbinder_call(hal_camera_server, hal_camera_client)
4*e4a36f41SAndroid Build Coastguard Worker
5*e4a36f41SAndroid Build Coastguard Worker#binder IPC from client to service manager and callbacks
6*e4a36f41SAndroid Build Coastguard Workerbinder_use(hal_camera_server)
7*e4a36f41SAndroid Build Coastguard Worker
8*e4a36f41SAndroid Build Coastguard Workerhal_attribute_hwservice(hal_camera, hal_camera_hwservice)
9*e4a36f41SAndroid Build Coastguard Workerhal_attribute_service(hal_camera, hal_camera_service)
10*e4a36f41SAndroid Build Coastguard Worker
11*e4a36f41SAndroid Build Coastguard Workerallow hal_camera device:dir r_dir_perms;
12*e4a36f41SAndroid Build Coastguard Workerallow hal_camera video_device:dir r_dir_perms;
13*e4a36f41SAndroid Build Coastguard Workerallow hal_camera video_device:chr_file rw_file_perms;
14*e4a36f41SAndroid Build Coastguard Workerallow hal_camera camera_device:chr_file rw_file_perms;
15*e4a36f41SAndroid Build Coastguard Workerallow hal_camera ion_device:chr_file rw_file_perms;
16*e4a36f41SAndroid Build Coastguard Workerallow hal_camera dmabuf_system_heap_device:chr_file r_file_perms;
17*e4a36f41SAndroid Build Coastguard Worker
18*e4a36f41SAndroid Build Coastguard Worker# Both the client and the server need to use the graphics allocator
19*e4a36f41SAndroid Build Coastguard Workerallow { hal_camera_client hal_camera_server } hal_graphics_allocator:fd use;
20*e4a36f41SAndroid Build Coastguard Worker
21*e4a36f41SAndroid Build Coastguard Worker# Allow hal_camera to use fd from app,gralloc,and ashmem HAL
22*e4a36f41SAndroid Build Coastguard Workerallow hal_camera { appdomain -isolated_app }:fd use;
23*e4a36f41SAndroid Build Coastguard Workerallow hal_camera surfaceflinger:fd use;
24*e4a36f41SAndroid Build Coastguard Workerallow hal_camera hal_allocator_server:fd use;
25*e4a36f41SAndroid Build Coastguard Worker
26*e4a36f41SAndroid Build Coastguard Worker# Needed to provide debug dump output via dumpsys' pipes.
27*e4a36f41SAndroid Build Coastguard Workerallow hal_camera shell:fd use;
28*e4a36f41SAndroid Build Coastguard Workerallow hal_camera shell:fifo_file write;
29*e4a36f41SAndroid Build Coastguard Worker
30*e4a36f41SAndroid Build Coastguard Worker###
31*e4a36f41SAndroid Build Coastguard Worker### neverallow rules
32*e4a36f41SAndroid Build Coastguard Worker###
33*e4a36f41SAndroid Build Coastguard Worker
34*e4a36f41SAndroid Build Coastguard Worker# hal_camera should never execute any executable without a
35*e4a36f41SAndroid Build Coastguard Worker# domain transition
36*e4a36f41SAndroid Build Coastguard Workerneverallow hal_camera_server { file_type fs_type }:file execute_no_trans;
37*e4a36f41SAndroid Build Coastguard Worker
38*e4a36f41SAndroid Build Coastguard Worker# hal_camera should never need network access. Disallow network sockets.
39*e4a36f41SAndroid Build Coastguard Workerneverallow hal_camera_server { domain userdebug_or_eng(`-su') }:{ tcp_socket udp_socket rawip_socket } *;
40*e4a36f41SAndroid Build Coastguard Worker
41*e4a36f41SAndroid Build Coastguard Worker# Only camera HAL may directly access the camera hardware
42*e4a36f41SAndroid Build Coastguard Workerneverallow { halserverdomain -hal_camera_server } camera_device:chr_file *;
43