Make system_server atrace category work with traced_probes
Historically most uses of atrace happen via the shell domain.
There are two exceptions:
- boot tracing
- traced_probes
We need to get feature parity, so atrace has the same behavior
when is invoked either via shell or from its own domain (e.g.
via traced_probes that has an auto_trans rule into atrace on exec).
Atrace works by setting system properties to enable tracing from userspace
then poking all the binder services to read the system properties (see [1]) so
enabling the system_server category requires the ability to call binder
methods on the system_server.
For more use cases see b/113127224
[1]: https://android.googlesource.com/platform/frameworks/native/+/9ead54bed65d486fe435793cbe98ed8b4786f7be/cmds/atrace/atrace.cpp#545
Bug: 113127224
Test: Add an atrace category to the Perfetto config and confirm the data
shows up.
Cherry-picked from aosp/747608
Change-Id: Id077eff960ffb1cdd7b0ce84b21ac9ef70444a4a
Merged-In: Id077eff960ffb1cdd7b0ce84b21ac9ef70444a4a
diff --git a/prebuilts/api/28.0/private/atrace.te b/prebuilts/api/28.0/private/atrace.te
index 630935d..1b86d3e 100644
--- a/prebuilts/api/28.0/private/atrace.te
+++ b/prebuilts/api/28.0/private/atrace.te
@@ -22,6 +22,8 @@
binder_use(atrace)
allow atrace healthd:binder call;
allow atrace surfaceflinger:binder call;
+allow atrace system_server:binder call;
+
get_prop(atrace, hwservicemanager_prop)
allow atrace {
diff --git a/private/atrace.te b/private/atrace.te
index 630935d..1b86d3e 100644
--- a/private/atrace.te
+++ b/private/atrace.te
@@ -22,6 +22,8 @@
binder_use(atrace)
allow atrace healthd:binder call;
allow atrace surfaceflinger:binder call;
+allow atrace system_server:binder call;
+
get_prop(atrace, hwservicemanager_prop)
allow atrace {