Add ANR expiration trace points

This adds a trace point to the AnrTimer track for every expired
ANR. The trace point is the formatted string "%s(%d,%d,%s,%d)":
 * The operation (currently "expired")
 * The Linux pid that expired
 * The Linux uid that expired
 * The ANR category
 * The elapsed time (in ms) since the timer was scheduled

The elapsed time can be used to look backward in a trace to create a
synthetic slice that covers the span from when the timer was scheduled
to when it expired.

The trace point begins a slice, which ends when the client accepts or
discards the ANR.

This tracing is always on.  ANR expiration is uncommon, so there are
no performance issues.

Tested manually by generating an ANR and examining the resulting
perfetto trace.

Test: atest
 * FrameworksServicesTests:com.android.server.am
 * FrameworksMockingServicesTests:com.android.server.am
 * CtsAppTestCases
 * FrameworksServicesTests:AnrTimerTest

Bug: 319454931
Change-Id: Ie8c2ee28bca2b105fafebbbe84930e8f58e90598
2 files changed