1*e4a36f41SAndroid Build Coastguard Worker# mediametrics - daemon for collecting media.metrics data 2*e4a36f41SAndroid Build Coastguard Workertype mediametrics, domain; 3*e4a36f41SAndroid Build Coastguard Workertype mediametrics_exec, system_file_type, exec_type, file_type; 4*e4a36f41SAndroid Build Coastguard Worker 5*e4a36f41SAndroid Build Coastguard Worker 6*e4a36f41SAndroid Build Coastguard Workerbinder_use(mediametrics) 7*e4a36f41SAndroid Build Coastguard Workerbinder_call(mediametrics, binderservicedomain) 8*e4a36f41SAndroid Build Coastguard Workerbinder_service(mediametrics) 9*e4a36f41SAndroid Build Coastguard Worker 10*e4a36f41SAndroid Build Coastguard Workeradd_service(mediametrics, mediametrics_service) 11*e4a36f41SAndroid Build Coastguard Worker 12*e4a36f41SAndroid Build Coastguard Workerallow mediametrics system_server:fd use; 13*e4a36f41SAndroid Build Coastguard Worker 14*e4a36f41SAndroid Build Coastguard Workerr_dir_file(mediametrics, cgroup) 15*e4a36f41SAndroid Build Coastguard Workerr_dir_file(mediametrics, cgroup_v2) 16*e4a36f41SAndroid Build Coastguard Workerallow mediametrics proc_meminfo:file r_file_perms; 17*e4a36f41SAndroid Build Coastguard Worker 18*e4a36f41SAndroid Build Coastguard Worker# allows interactions with dumpsys to GMScore 19*e4a36f41SAndroid Build Coastguard Workerallow mediametrics { app_data_file privapp_data_file }:file write; 20*e4a36f41SAndroid Build Coastguard Worker 21*e4a36f41SAndroid Build Coastguard Worker# allow access to package manager for uid->apk mapping 22*e4a36f41SAndroid Build Coastguard Workerallow mediametrics package_native_service:service_manager find; 23*e4a36f41SAndroid Build Coastguard Worker 24*e4a36f41SAndroid Build Coastguard Worker# Allow metrics service to send information to statsd socket. 25*e4a36f41SAndroid Build Coastguard Workerunix_socket_send(mediametrics, statsdw, statsd) 26*e4a36f41SAndroid Build Coastguard Worker 27*e4a36f41SAndroid Build Coastguard Worker### 28*e4a36f41SAndroid Build Coastguard Worker### neverallow rules 29*e4a36f41SAndroid Build Coastguard Worker### 30*e4a36f41SAndroid Build Coastguard Worker 31*e4a36f41SAndroid Build Coastguard Worker# mediametrics should never execute any executable without a 32*e4a36f41SAndroid Build Coastguard Worker# domain transition 33*e4a36f41SAndroid Build Coastguard Workerneverallow mediametrics { file_type fs_type }:file execute_no_trans; 34*e4a36f41SAndroid Build Coastguard Worker 35*e4a36f41SAndroid Build Coastguard Worker# The goal of the mediaserver split is to place media processing code into 36*e4a36f41SAndroid Build Coastguard Worker# restrictive sandboxes with limited responsibilities and thus limited 37*e4a36f41SAndroid Build Coastguard Worker# permissions. Example: Audioserver is only responsible for controlling audio 38*e4a36f41SAndroid Build Coastguard Worker# hardware and processing audio content. Cameraserver does the same for camera 39*e4a36f41SAndroid Build Coastguard Worker# hardware/content. Etc. 40*e4a36f41SAndroid Build Coastguard Worker# 41*e4a36f41SAndroid Build Coastguard Worker# Media processing code is inherently risky and thus should have limited 42*e4a36f41SAndroid Build Coastguard Worker# permissions and be isolated from the rest of the system and network. 43*e4a36f41SAndroid Build Coastguard Worker# Lengthier explanation here: 44*e4a36f41SAndroid Build Coastguard Worker# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html 45*e4a36f41SAndroid Build Coastguard Workerneverallow mediametrics domain:{ tcp_socket udp_socket rawip_socket } *; 46