sdk: Fail gracefully when attempting to trace on an invalid backend
Adds a TracingBackendFake instance to TracingMuxerImpl, which
is used as a fallback backend for new tracing sessions in case they
specify a backend type that isn't available, e.g., because it wasn't
registered in Tracing::Initialize().
This backend instance simply disconnects consumers when they attempt to
connect. It still allows the SDK to register a producer with the
backend (in order to avoid a lot of connection retries or special
casing of the backend in the muxer), but ignores any data source
registrations.
Also fixes a few races during session callback registration.
Bug: 179761322
Change-Id: I1580461aad3711fb21f99db8e735d84ffe8cebda
diff --git a/Android.bp b/Android.bp
index 3352769..82338ee 100644
--- a/Android.bp
+++ b/Android.bp
@@ -8260,6 +8260,7 @@
"src/tracing/interceptor.cc",
"src/tracing/internal/checked_scope.cc",
"src/tracing/internal/interceptor_trace_writer.cc",
+ "src/tracing/internal/tracing_backend_fake.cc",
"src/tracing/internal/tracing_muxer_fake.cc",
"src/tracing/internal/tracing_muxer_impl.cc",
"src/tracing/internal/track_event_internal.cc",