Make FinalizerWatchDogDaemon also monitor RQDaemon

We always checked for nonterminating finalizers, but we did not check
whether the ReferenceQueueDaemon got stuck. We've increasingly been
relying on Java 8 (not Java 9) Cleaners, which run non-libcore code
in the ReferenceQueueDaemon, often through NativeAllocationRegistry.
Have FinalizerWatchDogDaemon monitor it as well.

We have not actually encountered a failure based on this, but not
monitoring it complicates debugging.

This avoids the cost of another thread, at the cost of slightly more
complex code. This slightly slows down ReferenceQueueDaemon, and a
bit more code complexity was required to avoid slowing it down more.

We currently only give very minimal information about where
ReferenceQueueDaemon might be stuck. Hopefully the tombstone
would supply more.

Bug: 197500807
Test: Build and boot AOSP
Change-Id: I9093ab285226b0a8d04ea509dd6c7ee34f5eb3e3
2 files changed