1*e4a36f41SAndroid Build Coastguard Worker# Domain for atrace process. 2*e4a36f41SAndroid Build Coastguard Worker# It is spawned either by traced_probes or by init for the boottrace service. 3*e4a36f41SAndroid Build Coastguard Worker 4*e4a36f41SAndroid Build Coastguard Workertype atrace, domain, coredomain; 5*e4a36f41SAndroid Build Coastguard Workertype atrace_exec, exec_type, file_type, system_file_type; 6*e4a36f41SAndroid Build Coastguard Worker 7*e4a36f41SAndroid Build Coastguard Worker# boottrace services uses /data/misc/boottrace/categories 8*e4a36f41SAndroid Build Coastguard Workerallow atrace boottrace_data_file:dir search; 9*e4a36f41SAndroid Build Coastguard Workerallow atrace boottrace_data_file:file r_file_perms; 10*e4a36f41SAndroid Build Coastguard Worker 11*e4a36f41SAndroid Build Coastguard Worker# Allow atrace to access tracefs. 12*e4a36f41SAndroid Build Coastguard Workerallow atrace debugfs_tracing:dir r_dir_perms; 13*e4a36f41SAndroid Build Coastguard Workerallow atrace debugfs_tracing:file rw_file_perms; 14*e4a36f41SAndroid Build Coastguard Workerallow atrace debugfs_trace_marker:file getattr; 15*e4a36f41SAndroid Build Coastguard Worker 16*e4a36f41SAndroid Build Coastguard Worker# Allow atrace to write data when a pipe is used for stdout/stderr 17*e4a36f41SAndroid Build Coastguard Worker# This is used by Perfetto to capture the output on error in atrace. 18*e4a36f41SAndroid Build Coastguard Workerallow atrace traced_probes:fd use; 19*e4a36f41SAndroid Build Coastguard Workerallow atrace traced_probes:fifo_file write; 20*e4a36f41SAndroid Build Coastguard Worker 21*e4a36f41SAndroid Build Coastguard Worker# atrace sets debug.atrace.* properties 22*e4a36f41SAndroid Build Coastguard Workerset_prop(atrace, debug_prop) 23*e4a36f41SAndroid Build Coastguard Worker 24*e4a36f41SAndroid Build Coastguard Worker# atrace pokes all the binder-enabled processes at startup with a 25*e4a36f41SAndroid Build Coastguard Worker# SYSPROPS_TRANSACTION, to tell them to reload the debug.atrace.* properties. 26*e4a36f41SAndroid Build Coastguard Worker 27*e4a36f41SAndroid Build Coastguard Workerbinder_use(atrace) 28*e4a36f41SAndroid Build Coastguard Workerallow atrace healthd:binder call; 29*e4a36f41SAndroid Build Coastguard Workerallow atrace surfaceflinger:binder call; 30*e4a36f41SAndroid Build Coastguard Workerallow atrace system_server:binder call; 31*e4a36f41SAndroid Build Coastguard Worker 32*e4a36f41SAndroid Build Coastguard Workerget_prop(atrace, hwservicemanager_prop) 33*e4a36f41SAndroid Build Coastguard Worker 34*e4a36f41SAndroid Build Coastguard Worker# atrace can call atrace HAL 35*e4a36f41SAndroid Build Coastguard Workerhal_client_domain(atrace, hal_atrace) 36*e4a36f41SAndroid Build Coastguard Worker 37*e4a36f41SAndroid Build Coastguard Workerallow atrace { 38*e4a36f41SAndroid Build Coastguard Worker service_manager_type 39*e4a36f41SAndroid Build Coastguard Worker -apex_service 40*e4a36f41SAndroid Build Coastguard Worker -incident_service 41*e4a36f41SAndroid Build Coastguard Worker -iorapd_service 42*e4a36f41SAndroid Build Coastguard Worker -netd_service 43*e4a36f41SAndroid Build Coastguard Worker -dnsresolver_service 44*e4a36f41SAndroid Build Coastguard Worker -stats_service 45*e4a36f41SAndroid Build Coastguard Worker -dumpstate_service 46*e4a36f41SAndroid Build Coastguard Worker -installd_service 47*e4a36f41SAndroid Build Coastguard Worker -vold_service 48*e4a36f41SAndroid Build Coastguard Worker -lpdump_service 49*e4a36f41SAndroid Build Coastguard Worker}:service_manager { find }; 50*e4a36f41SAndroid Build Coastguard Workerallow atrace servicemanager:service_manager list; 51*e4a36f41SAndroid Build Coastguard Worker 52*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 53*e4a36f41SAndroid Build Coastguard Worker # atrace is generally invoked as a standalone binary from shell or perf 54*e4a36f41SAndroid Build Coastguard Worker # daemons like Perfetto traced_probes. However, in userdebug builds, there is 55*e4a36f41SAndroid Build Coastguard Worker # a further option to run atrace as an init daemon for boot tracing. 56*e4a36f41SAndroid Build Coastguard Worker init_daemon_domain(atrace) 57*e4a36f41SAndroid Build Coastguard Worker 58*e4a36f41SAndroid Build Coastguard Worker allow atrace debugfs_tracing_debug:dir r_dir_perms; 59*e4a36f41SAndroid Build Coastguard Worker allow atrace debugfs_tracing_debug:file rw_file_perms; 60*e4a36f41SAndroid Build Coastguard Worker') 61