1type mediacodec, domain, mlstrustedsubject;
2type mediacodec_exec, exec_type, vendor_file_type, file_type;
3
4init_daemon_domain(mediacodec)
5
6# can route /dev/binder traffic to /dev/vndbinder
7vndbinder_use(mediacodec)
8
9hal_server_domain(mediacodec, hal_codec2)
10hal_server_domain(mediacodec, hal_omx)
11
12# mediacodec may use an input surface from a different Codec2 or OMX service
13hal_client_domain(mediacodec, hal_codec2)
14hal_client_domain(mediacodec, hal_omx)
15
16hal_client_domain(mediacodec, hal_allocator)
17hal_client_domain(mediacodec, hal_graphics_allocator)
18
19allow mediacodec gpu_device:chr_file rw_file_perms;
20allow mediacodec ion_device:chr_file rw_file_perms;
21allow mediacodec video_device:chr_file rw_file_perms;
22allow mediacodec video_device:dir search;
23
24crash_dump_fallback(mediacodec)
25
26# get aac_drc_* properties
27get_prop(mediacodec, aac_drc_prop)
28
29# mediacodec should never execute any executable without a domain transition
30neverallow mediacodec { file_type fs_type }:file execute_no_trans;
31
32# Media processing code is inherently risky and thus should have limited
33# permissions and be isolated from the rest of the system and network.
34# Lengthier explanation here:
35# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
36neverallow mediacodec domain:{ tcp_socket udp_socket rawip_socket } *;
37
38