Add anr tracing to AnrTimerService
This change allows user to configure tracing on ANR timers for
specified processes. Configuration is through the `am` shell command;
it is meant to be used by application or system developers - not by
end users. When a timer is traced, extra actions can be executed at
the "split point" - an early timeout specified as a percentage of the
originally programmed timeout. Information at the early timeout helps
developers analyze current or incipient ANRs.
Tested by manually generating an ANR (using a custom app) and
verifying that the expected perfetto trace events were created or
that the timer expired, as appropriate.
The command to generate trace points on a process's timer is:
`adb shell am trace-timer name="anrtimer.receiver"`
The command to generate tracepoints and expire a timer at the 20% point is:
`adb shell am trace-timer name="anrtimer.receiver" expire=20`
The command to disable tracing, if it was ever enabled, is:
`adb shell am trace-timer off`
Bug: 352085328
Flag: com.android.server.utils.anr_timer_trace
Test: atest
* FrameworksServicesTests:com.android.server.am
* FrameworksServicesTests:AnrTimerTest
Change-Id: Ibc30f1f488baff056225671f063f026ce30e2e6f
5 files changed