Add ANR/Watchdog subject to trace.

Test: Manual.
Bug: b/184939999

Change-Id: Iaaf378276cad42eea881ffeecbf1964a69d268fe
This commit is contained in:
Yandry Perez Clemente
2021-11-22 12:29:53 +00:00
parent 0f8f6a0d89
commit 99d97b2682
3 changed files with 15 additions and 0 deletions

View File

@@ -685,6 +685,7 @@ public class Watchdog {
final UUID errorId = mTraceErrorLogger.generateErrorId();
if (mTraceErrorLogger.isAddErrorIdEnabled()) {
mTraceErrorLogger.addErrorIdToTrace("system_server", errorId);
mTraceErrorLogger.addSubjectToTrace(subject, errorId);
}
// Log the atom as early as possible since it is used as a mechanism to trigger

View File

@@ -286,6 +286,7 @@ class ProcessErrorStateRecord {
&& mService.mTraceErrorLogger.isAddErrorIdEnabled()) {
errorId = mService.mTraceErrorLogger.generateErrorId();
mService.mTraceErrorLogger.addErrorIdToTrace(mApp.processName, errorId);
mService.mTraceErrorLogger.addSubjectToTrace(annotation, errorId);
} else {
errorId = null;
}

View File

@@ -54,4 +54,17 @@ public class TraceErrorLogger {
COUNTER_PREFIX + processName + "#" + errorId.toString(),
PLACEHOLDER_VALUE);
}
/**
* Pushes a counter containing an ANR/Watchdog subject and a unique id so that the subject
* can be uniquely identified.
*
* @param subject The subject to include in the trace.
* @param errorId The unique id with which to tag the trace.
*/
public void addSubjectToTrace(String subject, UUID errorId) {
Trace.traceCounter(Trace.TRACE_TAG_ACTIVITY_MANAGER,
String.format("Subject(for ErrorId %s):%s", errorId.toString(), subject),
PLACEHOLDER_VALUE);
}
}