[Sb refactor] Add local logcat echoing to TableLogBuffer
TableLogBuffer is a sibling of LogBuffer, so it needs to reimplement the
desirable behaviors of Logbuffer. In this CL, we're adding support for
local logcat echoing on every table. The logging happens only in the
background and can fail silently so that it never blocks the main
thread.
This implementation differs from the LogBuffer implementation which was
written before the coroutines library was available, so it doesn't use
a background thread-per-table like the LogBuffer implementation does.
Rather, this implementation uses a Channel + a background
CoroutineDispatcher to execute all logging in the background.
We do leverage the existing LogcatEchoTracker class, which implements a
generic settings listener + settings format for turning logcat echoing
on at the buffer or tag level. In our case, the buffer name is the name
of the table, and the tags are the column names.
Note that all TableLogBuffer logs are considered to be `LogLevel.DEBUG`
since the API for `logChange` does not let the caller decide on a log
level. Arguably this makes perfect sense since table logs are _not_
meant to be warning or error logs. We could probably make the case that
they are `info` or `verbose`, but that would be immaterial to this
overall change.
Test: existing tests in tests/src/com/android/systemui/statusbar/pipelinestyle
Test: TableLogBufferTest
Test: manual
Bug: 255951648
Change-Id: I930e4c7730117860ab22e8849c84f1f96f786b30
13 files changed