xref: /aosp_15_r20/system/sepolicy/prebuilts/api/30.0/public/mediametrics.te (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
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 Workerallow mediametrics proc_meminfo:file r_file_perms;
16*e4a36f41SAndroid Build Coastguard Worker
17*e4a36f41SAndroid Build Coastguard Worker# allows interactions with dumpsys to GMScore
18*e4a36f41SAndroid Build Coastguard Workerallow mediametrics { app_data_file privapp_data_file }:file write;
19*e4a36f41SAndroid Build Coastguard Worker
20*e4a36f41SAndroid Build Coastguard Worker# allow access to package manager for uid->apk mapping
21*e4a36f41SAndroid Build Coastguard Workerallow mediametrics package_native_service:service_manager find;
22*e4a36f41SAndroid Build Coastguard Worker
23*e4a36f41SAndroid Build Coastguard Worker# Allow metrics service to send information to statsd socket.
24*e4a36f41SAndroid Build Coastguard Workerunix_socket_send(mediametrics, statsdw, statsd)
25*e4a36f41SAndroid Build Coastguard Worker
26*e4a36f41SAndroid Build Coastguard Worker###
27*e4a36f41SAndroid Build Coastguard Worker### neverallow rules
28*e4a36f41SAndroid Build Coastguard Worker###
29*e4a36f41SAndroid Build Coastguard Worker
30*e4a36f41SAndroid Build Coastguard Worker# mediametrics should never execute any executable without a
31*e4a36f41SAndroid Build Coastguard Worker# domain transition
32*e4a36f41SAndroid Build Coastguard Workerneverallow mediametrics { file_type fs_type }:file execute_no_trans;
33*e4a36f41SAndroid Build Coastguard Worker
34*e4a36f41SAndroid Build Coastguard Worker# The goal of the mediaserver split is to place media processing code into
35*e4a36f41SAndroid Build Coastguard Worker# restrictive sandboxes with limited responsibilities and thus limited
36*e4a36f41SAndroid Build Coastguard Worker# permissions. Example: Audioserver is only responsible for controlling audio
37*e4a36f41SAndroid Build Coastguard Worker# hardware and processing audio content. Cameraserver does the same for camera
38*e4a36f41SAndroid Build Coastguard Worker# hardware/content. Etc.
39*e4a36f41SAndroid Build Coastguard Worker#
40*e4a36f41SAndroid Build Coastguard Worker# Media processing code is inherently risky and thus should have limited
41*e4a36f41SAndroid Build Coastguard Worker# permissions and be isolated from the rest of the system and network.
42*e4a36f41SAndroid Build Coastguard Worker# Lengthier explanation here:
43*e4a36f41SAndroid Build Coastguard Worker# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
44*e4a36f41SAndroid Build Coastguard Workerneverallow mediametrics domain:{ tcp_socket udp_socket rawip_socket } *;
45