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
diff --git a/private/platform_app.te b/private/platform_app.te
index cd95353..eb1a7c7 100644
--- a/private/platform_app.te
+++ b/private/platform_app.te
@@ -64,10 +64,24 @@
   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.
 userdebug_or_eng(`
   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;