From a64d5bb7efdd896926fd5dd6bed4bddd865d8bd2 Mon Sep 17 00:00:00 2001
From: Primiano Tucci <primiano@google.com>
Date: Thu, 10 Jan 2019 20:07:51 +0000
Subject: [PATCH] Allow perfetto to ingest logs on userdebug/eng

When recording hour-long traces, logcat messages help
to interpret the trace, giving human readable context on what
is happening on the system.
Furthermore this is particularly helpful for startup
debugging thanks to activity manager instrumentation events
(am_on_create_called, am_on_start, ...).
This is only allowed on userdebug/eng builds.

Bug: 122243384
Change-Id: I4dfaebf21107e9853b0bf42403fbab6c3b4d5141
---
 private/traced_probes.te | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/private/traced_probes.te b/private/traced_probes.te
index ad6611c94..8aa475e65 100644
--- a/private/traced_probes.te
+++ b/private/traced_probes.te
@@ -66,10 +66,12 @@ allow traced_probes {
   proc_stat
 }:file r_file_perms;
 
-
 # Allow access to the IHealth HAL service for tracing battery counters.
 hal_client_domain(traced_probes, hal_health)
 
+# On debug builds allow to ingest system logs into the trace.
+userdebug_or_eng(`read_logd(traced_probes)')
+
 ###
 ### Neverallow rules
 ###
-- 
GitLab