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