Add --bin option to record_android_trace

This allows passing in a binary configuration with the `-c` option. This
can be useful in two scenarios.
1. To have "universal" configs that allow working on older Android
   versions without complaining that a field name is unknown. Rather,
   the newer fields may be ignored by Perfetto.
2. To run configs used by new SDK-users that aren't known by Perfetto.
   In such cases, Perfetto wouldn't be able to parse the text proto
   config but can pass along the binary config to the correct producer.

Test: running record_android_trace locally with binary config
Change-Id: I2f5e27dc3e3caff697cef4c6c39da07ff7e09f25
diff --git a/python/tools/record_android_trace.py b/python/tools/record_android_trace.py
index 1b1e659..4d8ac2b 100644
--- a/python/tools/record_android_trace.py
+++ b/python/tools/record_android_trace.py
@@ -159,6 +159,9 @@
   help = 'Can be generated with https://ui.perfetto.dev/#!/record'
   grp.add_argument('-c', '--config', default=None, help=help)
 
+  help = 'Parse input from --config as binary proto (default: parse as text)'
+  grp.add_argument('--bin', action='store_true', help=help)
+
   args = parser.parse_args()
   args.sideload = args.sideload or args.sideload_path is not None
 
@@ -231,7 +234,9 @@
   fname = '%s-%s.pftrace' % (tstamp, os.urandom(3).hex())
   device_file = device_dir + fname
 
-  cmd = [perfetto_cmd, '--background', '--txt', '-o', device_file]
+  cmd = [perfetto_cmd, '--background', '-o', device_file]
+  if not args.bin:
+    cmd.append('--txt')
   on_device_config = None
   on_host_config = None
   if args.config is not None: