Enable platform_app to use perfetto/trace_data_file permissions in

debug/eng builds.

This change is to allow SystemUI, a platform_app, to start, stop,
and share Perfetto/Winscope traces.

Bug: 305049544
Test: Verified everything works on my local device.
Change-Id: I8fc35a5a570c2199cfdd95418a6caf0c48111c46
This commit is contained in:
Stefan Andonian 2024-01-24 22:04:52 +00:00
parent 067f7db593
commit ff413fd7d0
2 changed files with 17 additions and 1 deletions

View file

@ -64,10 +64,24 @@ userdebug_or_eng(`
auditallow platform_app proc_net_type:{ dir file lnk_file } { getattr open read }; auditallow platform_app proc_net_type:{ dir file lnk_file } { getattr open read };
') ')
# Allow sharing traces to betterbug from /data/misc/wmtrace.
userdebug_or_eng(`
allow platform_app trace_data_file:file create_file_perms;
allow platform_app trace_data_file:dir rw_dir_perms;
')
# Allow writing and removing wmshell protolog in /data/misc/wmtrace. # Allow writing and removing wmshell protolog in /data/misc/wmtrace.
userdebug_or_eng(` userdebug_or_eng(`
allow platform_app wm_trace_data_file:dir rw_dir_perms; allow platform_app wm_trace_data_file:dir rw_dir_perms;
allow platform_app wm_trace_data_file:file { getattr setattr create unlink w_file_perms }; allow platform_app wm_trace_data_file:file { getattr setattr create unlink rw_file_perms };
')
# To exec the perfetto cmdline client and pass it the trace config on
# stdint through a pipe. Allow to access traced's privileged consumer socket.
userdebug_or_eng(`
allow platform_app perfetto_exec:file rx_file_perms;
unix_socket_connect(platform_app, traced_consumer, traced);
') ')
allow platform_app audioserver_service:service_manager find; allow platform_app audioserver_service:service_manager find;

View file

@ -28,6 +28,7 @@ allow traced perfetto_traces_data_file:dir rw_dir_perms;
# Allow traceur to pass open file descriptors to traced, so traced can directly # Allow traceur to pass open file descriptors to traced, so traced can directly
# write into the output file without doing roundtrips over IPC. # write into the output file without doing roundtrips over IPC.
allow traced traceur_app:fd use; allow traced traceur_app:fd use;
allow traced platform_app:fd use;
allow traced trace_data_file:file { read write }; allow traced trace_data_file:file { read write };
# Allow perfetto to access the proxy service for notifying Traceur. # Allow perfetto to access the proxy service for notifying Traceur.
@ -119,6 +120,7 @@ neverallow {
-traced -traced
-dumpstate -dumpstate
-traceur_app -traceur_app
-platform_app
-shell -shell
-system_server -system_server
-perfetto -perfetto