HealthMonitor: handle edge cases of tasks timing out

...when the task ended long before the monitor thread
processes the event queue. This isn't expected to
happen, but has been observed in user logs.

Bug: b/260907576.
Test: Added unit tests, manually repro'ed bug
Change-Id: Ib9d89fcdd8230819c7c6baec6e0114c54fc04d7b
2 files changed