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;
19
20crash_dump_fallback(mediacodec_google)
21
22# mediacodec_google should never execute any executable without a domain transition
23neverallow mediacodec_google { file_type fs_type }:file execute_no_trans;
24
25# Media processing code is inherently risky and thus should have limited
26# permissions and be isolated from the rest of the system and network.
27# Lengthier explanation here:
28# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
29neverallow mediacodec_google domain:{ udp_socket rawip_socket } *;
30neverallow mediacodec_google { domain userdebug_or_eng(`-su') }:tcp_socket *;
31
32userdebug_or_eng(`
33 allow mediacodec_google vendor_media_data_file:dir rw_dir_perms;
34 allow mediacodec_google vendor_media_data_file:file create_file_perms;
35')
36