Move dumpAnrStateLocked off the critical ANR path
Shift the execution of dumpAnrStateLocked to the foreground thread to allow concurrent operation with the stack dump for the ANRing process.
This significantly reduces the time to initiate the stack dump (~70 ms on a Pixel 5 device)for input dispatching timeout ANRs.
This change addresses a major source of nativePollOnce (message queue idle) ANRs, which is the latency in initiating stack dumps.
Bug: 272292150
Test: make sure dumpAnrStateLocked behaves as expected
Test: Manual test: make sure the duration array has the correct value
Test: atest FrameworksServicesTests:AnrHelperTest
Change-Id: Ic7a2391c365501b4b4b19c0fbc4d3f22e37f1918
2 files changed