1# cameraserver - camera daemon 2type cameraserver, domain; 3type cameraserver_exec, system_file_type, exec_type, file_type; 4type cameraserver_tmpfs, file_type; 5 6binder_use(cameraserver) 7binder_call(cameraserver, binderservicedomain) 8binder_call(cameraserver, appdomain) 9binder_service(cameraserver) 10 11hal_client_domain(cameraserver, hal_camera) 12 13hal_client_domain(cameraserver, hal_graphics_allocator) 14 15allow cameraserver ion_device:chr_file rw_file_perms; 16 17# Talk with graphics composer fences 18allow cameraserver hal_graphics_composer:fd use; 19 20add_service(cameraserver, cameraserver_service) 21add_hwservice(cameraserver, fwk_camera_hwservice) 22 23allow cameraserver activity_service:service_manager find; 24allow cameraserver appops_service:service_manager find; 25allow cameraserver audioserver_service:service_manager find; 26allow cameraserver batterystats_service:service_manager find; 27allow cameraserver cameraproxy_service:service_manager find; 28allow cameraserver mediaserver_service:service_manager find; 29allow cameraserver processinfo_service:service_manager find; 30allow cameraserver scheduling_policy_service:service_manager find; 31allow cameraserver sensor_privacy_service:service_manager find; 32allow cameraserver surfaceflinger_service:service_manager find; 33 34allow cameraserver hidl_token_hwservice:hwservice_manager find; 35 36### 37### neverallow rules 38### 39 40# cameraserver should never execute any executable without a 41# domain transition 42neverallow cameraserver { file_type fs_type }:file execute_no_trans; 43 44# The goal of the mediaserver split is to place media processing code into 45# restrictive sandboxes with limited responsibilities and thus limited 46# permissions. Example: Audioserver is only responsible for controlling audio 47# hardware and processing audio content. Cameraserver does the same for camera 48# hardware/content. Etc. 49# 50# Media processing code is inherently risky and thus should have limited 51# permissions and be isolated from the rest of the system and network. 52# Lengthier explanation here: 53# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html 54neverallow cameraserver domain:{ tcp_socket udp_socket rawip_socket } *; 55 56# Allow shell commands from ADB for CTS testing/dumping 57allow cameraserver adbd:fd use; 58allow cameraserver adbd:unix_stream_socket { read write }; 59allow cameraserver shell:fd use; 60allow cameraserver shell:unix_stream_socket { read write }; 61allow cameraserver shell:fifo_file { read write }; 62 63# Allow to talk with media codec 64allow cameraserver mediametrics_service:service_manager find; 65hal_client_domain(cameraserver, hal_codec2) 66hal_client_domain(cameraserver, hal_omx) 67hal_client_domain(cameraserver, hal_allocator) 68 69# Allow shell commands from ADB for CTS testing/dumping 70userdebug_or_eng(` 71 allow cameraserver su:fd use; 72 allow cameraserver su:fifo_file { read write }; 73 allow cameraserver su:unix_stream_socket { read write }; 74') 75