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