1type mediacodec_google, domain;
2type mediacodec_google_exec, exec_type, vendor_file_type, file_type;
3
4init_daemon_domain(mediacodec_google)
5
6vndbinder_use(mediacodec_google)
7
8hal_server_domain(mediacodec_google, hal_codec2)
9
10# mediacodec_google may use an input surface from a different Codec2 service
11hal_client_domain(mediacodec_google, hal_codec2)
12
13hal_client_domain(mediacodec_google, hal_graphics_allocator)
14
15allow mediacodec_google dmabuf_system_heap_device:chr_file r_file_perms;
16allow mediacodec_google dmabuf_system_secure_heap_device:chr_file r_file_perms;
17allow mediacodec_google video_device:chr_file rw_file_perms;
18allow mediacodec_google gpu_device:chr_file rw_file_perms;
19allow mediacodec_google self:global_capability_class_set sys_nice;
20
21crash_dump_fallback(mediacodec_google)
22
23# mediacodec_google should never execute any executable without a domain transition
24neverallow mediacodec_google { file_type fs_type }:file execute_no_trans;
25
26# Media processing code is inherently risky and thus should have limited
27# permissions and be isolated from the rest of the system and network.
28# Lengthier explanation here:
29# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
30neverallow mediacodec_google domain:{ udp_socket rawip_socket } *;
31neverallow mediacodec_google { domain userdebug_or_eng(`-su') }:tcp_socket *;
32
33userdebug_or_eng(`
34 allow mediacodec_google vendor_media_data_file:dir rw_dir_perms;
35 allow mediacodec_google vendor_media_data_file:file create_file_perms;
36')
37