Streamline dump state for input ANR

This reduce ~90% execution time and memory usage of the dump.
The case when there are only the home and ANR app:
 80ms -> 5ms
 111k chars -> 11k

- Only dump related task/activity/window
- Removed the looper dump in DisplayPolicy because PhoneWindowManager
  already has the same info.

Bug: 322386106
Bug: 322947521
Test: Trigger ANR by a an activity that sleeps 6s on UI thread.
      Check the duration of trace dumpAnrStateLocked.
      Check the output from
       adb shell dumpsys activity lastanr
       adb shell dumpsys window lastanr

Change-Id: I5db34283cf5ef02bce10827f2a1be7523b5852b9
5 files changed