From 8af943456335955cd92794c53c0a411805f9aedf Mon Sep 17 00:00:00 2001 From: Yandry Perez Clemente Date: Sun, 23 May 2021 09:52:43 +0100 Subject: [PATCH] Log atom ANROccurredProcessingStarted Bug: b/188122403 Test: CTS test in ag/14695996 Change-Id: I6747336f4fe40949de1510fd5b4aed9a6e5bb455 --- .../com/android/server/am/ProcessErrorStateRecord.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/core/java/com/android/server/am/ProcessErrorStateRecord.java b/services/core/java/com/android/server/am/ProcessErrorStateRecord.java index 41edd75ab4a44..508bd0699b6bd 100644 --- a/services/core/java/com/android/server/am/ProcessErrorStateRecord.java +++ b/services/core/java/com/android/server/am/ProcessErrorStateRecord.java @@ -272,6 +272,13 @@ class ProcessErrorStateRecord { errorId = null; } + // This atom is only logged with the purpose of triggering Perfetto and the logging + // needs to happen as close as possible to the time when the ANR is detected. + // Also, it needs to be logged after adding the error id to the trace, to make sure + // the error id is present in the trace when the Perfetto trace is captured. + FrameworkStatsLog.write(FrameworkStatsLog.ANR_OCCURRED_PROCESSING_STARTED, + mApp.processName); + // Dump thread traces as quickly as we can, starting with "interesting" processes. firstPids.add(pid);