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