1type mediacodec_google, domain; 2type mediacodec_google_exec, exec_type, vendor_file_type, file_type; 3 4init_daemon_domain(mediacodec_google) 5 6# can route /dev/binder traffic to /dev/vndbinder 7vndbinder_use(mediacodec_google) 8 9hal_server_domain(mediacodec_google, hal_codec2) 10 11# mediacodec_google may use an input surface from a different Codec2 service 12hal_client_domain(mediacodec_google, hal_codec2) 13 14hal_client_domain(mediacodec_google, hal_graphics_allocator) 15 16allow mediacodec_google dmabuf_system_heap_device:chr_file r_file_perms; 17allow mediacodec_google dmabuf_system_secure_heap_device:chr_file r_file_perms; 18allow mediacodec_google video_device:chr_file rw_file_perms; 19allow mediacodec_google gpu_device:chr_file rw_file_perms; 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