ftrace_reader: Add FtraceConfigMuxer

Move the logic for handling enabling/disabling/adjusting ftrace
settings into a new class: FtraceConfigMuxer.

Ftrace is a bunch of globaly modifiable persistent state.
Given a number of FtraceConfig's we need to find the best union of all
the settings to make eveyone happy while also watching out for anybody
messing with the ftrace settings at the same time as us.

Specifically FtraceConfigMuxer takes in a *requested* FtraceConfig
(|RequestConfig|), makes a best effort attempt to modify the ftrace
debugfs files to honor those settings without interupting other perfetto
traces already in progress or other users of ftrace, then returns an
FtraceConfigId representing that config or zero on failure.

To see which settings we actually managed to set you can call |GetConfig|
and when you are finished with a config you can signal that with
|RemoveConfig|.

Bug: 73049510
Change-Id: I774ced0341c29ba8274c08170abbecc922dacb62
diff --git a/Android.bp b/Android.bp
index c4fa5a6..04e899d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -36,6 +36,7 @@
     "src/ftrace_reader/event_info_constants.cc",
     "src/ftrace_reader/format_parser.cc",
     "src/ftrace_reader/ftrace_config.cc",
+    "src/ftrace_reader/ftrace_config_muxer.cc",
     "src/ftrace_reader/ftrace_controller.cc",
     "src/ftrace_reader/ftrace_procfs.cc",
     "src/ftrace_reader/proto_translation_table.cc",
@@ -218,6 +219,7 @@
     "src/ftrace_reader/event_info_constants.cc",
     "src/ftrace_reader/format_parser.cc",
     "src/ftrace_reader/ftrace_config.cc",
+    "src/ftrace_reader/ftrace_config_muxer.cc",
     "src/ftrace_reader/ftrace_controller.cc",
     "src/ftrace_reader/ftrace_procfs.cc",
     "src/ftrace_reader/ftrace_procfs_integrationtest.cc",
@@ -1926,10 +1928,13 @@
     "src/ftrace_reader/format_parser.cc",
     "src/ftrace_reader/format_parser_unittest.cc",
     "src/ftrace_reader/ftrace_config.cc",
+    "src/ftrace_reader/ftrace_config_muxer.cc",
+    "src/ftrace_reader/ftrace_config_muxer_unittest.cc",
     "src/ftrace_reader/ftrace_config_unittest.cc",
     "src/ftrace_reader/ftrace_controller.cc",
     "src/ftrace_reader/ftrace_controller_unittest.cc",
     "src/ftrace_reader/ftrace_procfs.cc",
+    "src/ftrace_reader/ftrace_procfs_unittest.cc",
     "src/ftrace_reader/proto_translation_table.cc",
     "src/ftrace_reader/proto_translation_table_unittest.cc",
     "src/ftrace_reader/test/cpu_reader_support.cc",