shared_lib: Simplify producer initialization

Instead of having a separate ABI to initialize all backends we can call
the in process and system ABI one after the other (it was not possible
before).

Bug: 184929776
Change-Id: Ic6d26de378439365eaff1dc1929cd124d1b47b06
diff --git a/include/perfetto/public/abi/BUILD.gn b/include/perfetto/public/abi/BUILD.gn
index f16c4d4..f379c15 100644
--- a/include/perfetto/public/abi/BUILD.gn
+++ b/include/perfetto/public/abi/BUILD.gn
@@ -25,7 +25,7 @@
     "data_source_abi.h",
     "heap_buffer.h",
     "pb_decoder_abi.h",
-    "producer.h",
+    "producer_abi.h",
     "stream_writer_abi.h",
     "tracing_session_abi.h",
   ]
diff --git a/include/perfetto/public/abi/producer.h b/include/perfetto/public/abi/producer_abi.h
similarity index 76%
rename from include/perfetto/public/abi/producer.h
rename to include/perfetto/public/abi/producer_abi.h
index f3e7caf..94dc134 100644
--- a/include/perfetto/public/abi/producer.h
+++ b/include/perfetto/public/abi/producer_abi.h
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef INCLUDE_PERFETTO_PUBLIC_ABI_PRODUCER_H_
-#define INCLUDE_PERFETTO_PUBLIC_ABI_PRODUCER_H_
+#ifndef INCLUDE_PERFETTO_PUBLIC_ABI_PRODUCER_ABI_H_
+#define INCLUDE_PERFETTO_PUBLIC_ABI_PRODUCER_ABI_H_
 
 #include <stdint.h>
 
@@ -31,11 +31,8 @@
 // Initializes the global in-process perfetto producer.
 PERFETTO_SDK_EXPORT void PerfettoProducerInProcessInit(void);
 
-// Initializes both the global in-process and system perfetto producer.
-PERFETTO_SDK_EXPORT void PerfettoProducerInProcessAndSystemInit(void);
-
 #ifdef __cplusplus
 }
 #endif
 
-#endif  // INCLUDE_PERFETTO_PUBLIC_ABI_PRODUCER_H_
+#endif  // INCLUDE_PERFETTO_PUBLIC_ABI_PRODUCER_ABI_H_
diff --git a/include/perfetto/public/producer.h b/include/perfetto/public/producer.h
index a85cf78..4545baa 100644
--- a/include/perfetto/public/producer.h
+++ b/include/perfetto/public/producer.h
@@ -18,7 +18,7 @@
 #define INCLUDE_PERFETTO_PUBLIC_PRODUCER_H_
 
 #include "perfetto/public/abi/backend_type.h"
-#include "perfetto/public/abi/producer.h"
+#include "perfetto/public/abi/producer_abi.h"
 
 // Arguments for PerfettoProducerInit. This struct is not ABI-stable, fields can
 // be added and rearranged.
@@ -29,12 +29,10 @@
 
 // Initializes the global perfetto producer.
 static inline void PerfettoProducerInit(struct PerfettoProducerInitArgs args) {
-  if (args.backends & PERFETTO_BACKEND_IN_PROCESS &&
-      args.backends & PERFETTO_BACKEND_SYSTEM) {
-    PerfettoProducerInProcessAndSystemInit();
-  } else if (args.backends & PERFETTO_BACKEND_IN_PROCESS) {
+  if (args.backends & PERFETTO_BACKEND_IN_PROCESS) {
     PerfettoProducerInProcessInit();
-  } else if (args.backends & PERFETTO_BACKEND_SYSTEM) {
+  }
+  if (args.backends & PERFETTO_BACKEND_SYSTEM) {
     PerfettoProducerSystemInit();
   }
 }
diff --git a/src/shared_lib/producer.cc b/src/shared_lib/producer.cc
index 04e001e..aa858be 100644
--- a/src/shared_lib/producer.cc
+++ b/src/shared_lib/producer.cc
@@ -14,10 +14,7 @@
  * limitations under the License.
  */
 
-#include "perfetto/public/abi/producer.h"
-
-#include <atomic>
-#include <bitset>
+#include "perfetto/public/abi/producer_abi.h"
 
 #include "perfetto/tracing/backend_type.h"
 #include "perfetto/tracing/tracing.h"
@@ -33,9 +30,3 @@
   args.backends = perfetto::kSystemBackend;
   perfetto::Tracing::Initialize(args);
 }
-
-void PerfettoProducerInProcessAndSystemInit() {
-  perfetto::TracingInitArgs args;
-  args.backends = perfetto::kInProcessBackend | perfetto::kSystemBackend;
-  perfetto::Tracing::Initialize(args);
-}