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