Make traced a top-level executable

- Make a little change to the Android blueprint generator, which
  makes it so that executables in the top-level BUILD.gn file
  don't get the perfetto_ prefix. This allows to get a binary
  in the Android.bp that is called just "traced" and ends up in
  /system/bin/traced
- Adds the consumer_cmd binary introduced by the previous change
  (Iccf88b7b1d2beb6a0750adafd86d92a0f563182d) to the blueprint.

Bug:
Change-Id: Ia091ba35f186a451c4c0e111fcc03a0d8decf816
diff --git a/Android.bp b/Android.bp
index 75dd1c3..e833d98 100644
--- a/Android.bp
+++ b/Android.bp
@@ -559,75 +559,6 @@
   ],
 }
 
-// GN target: //src/traced:traced
-cc_binary {
-  name: "perfetto_src_traced_traced",
-  srcs: [
-    ":perfetto_protos_ftrace_lite_gen",
-    ":perfetto_protos_ftrace_zero_gen",
-    ":perfetto_protos_lite_gen",
-    ":perfetto_protos_tracing_service_lite_gen",
-    ":perfetto_protos_tracing_service_tracing_service_gen",
-    ":perfetto_protos_zero_gen",
-    ":perfetto_src_ipc_wire_protocol_gen",
-    "src/base/android_task_runner.cc",
-    "src/base/page_allocator.cc",
-    "src/base/thread_checker.cc",
-    "src/base/unix_task_runner.cc",
-    "src/ftrace_reader/cpu_reader.cc",
-    "src/ftrace_reader/event_info.cc",
-    "src/ftrace_reader/format_parser.cc",
-    "src/ftrace_reader/ftrace_controller.cc",
-    "src/ftrace_reader/ftrace_procfs.cc",
-    "src/ftrace_reader/ftrace_to_proto.cc",
-    "src/ftrace_reader/proto_translation_table.cc",
-    "src/ipc/buffered_frame_deserializer.cc",
-    "src/ipc/client_impl.cc",
-    "src/ipc/deferred.cc",
-    "src/ipc/host_impl.cc",
-    "src/ipc/service_proxy.cc",
-    "src/ipc/unix_socket.cc",
-    "src/protozero/proto_utils.cc",
-    "src/protozero/protozero_message.cc",
-    "src/protozero/protozero_message_handle.cc",
-    "src/protozero/scattered_stream_writer.cc",
-    "src/traced/probes/probes.cc",
-    "src/traced/service/service.cc",
-    "src/traced/traced.cc",
-    "src/tracing/core/chunked_protobuf_input_stream.cc",
-    "src/tracing/core/data_source_config.cc",
-    "src/tracing/core/data_source_descriptor.cc",
-    "src/tracing/core/id_allocator.cc",
-    "src/tracing/core/service_impl.cc",
-    "src/tracing/core/shared_memory_abi.cc",
-    "src/tracing/core/shared_memory_arbiter.cc",
-    "src/tracing/core/trace_config.cc",
-    "src/tracing/core/trace_packet.cc",
-    "src/tracing/core/trace_writer_impl.cc",
-  ],
-  shared_libs: [
-    "libandroid",
-    "liblog",
-    "libprotobuf-cpp-lite",
-  ],
-  static_libs: [
-    "libgtest_prod",
-    "perfetto_src_tracing_ipc",
-  ],
-  generated_headers: [
-    "perfetto_protos_ftrace_lite_gen_headers",
-    "perfetto_protos_ftrace_zero_gen_headers",
-    "perfetto_protos_lite_gen_headers",
-    "perfetto_protos_tracing_service_lite_gen_headers",
-    "perfetto_protos_tracing_service_tracing_service_gen_headers",
-    "perfetto_protos_zero_gen_headers",
-    "perfetto_src_ipc_wire_protocol_gen_headers",
-  ],
-  defaults: [
-    "perfetto_defaults",
-  ],
-}
-
 // GN target: //src/tracing:ipc
 cc_library_static {
   name: "perfetto_src_tracing_ipc",
@@ -806,3 +737,132 @@
     "perfetto_defaults",
   ],
 }
+
+// GN target: //src/tracing:consumer_cmd
+cc_binary {
+  name: "src_tracing_consumer_cmd",
+  srcs: [
+    ":perfetto_protos_ftrace_lite_gen",
+    ":perfetto_protos_ftrace_zero_gen",
+    ":perfetto_protos_lite_gen",
+    ":perfetto_protos_tracing_service_lite_gen",
+    ":perfetto_protos_tracing_service_tracing_service_gen",
+    ":perfetto_protos_zero_gen",
+    ":perfetto_src_ipc_wire_protocol_gen",
+    "src/base/android_task_runner.cc",
+    "src/base/page_allocator.cc",
+    "src/base/thread_checker.cc",
+    "src/base/unix_task_runner.cc",
+    "src/ipc/buffered_frame_deserializer.cc",
+    "src/ipc/client_impl.cc",
+    "src/ipc/deferred.cc",
+    "src/ipc/host_impl.cc",
+    "src/ipc/service_proxy.cc",
+    "src/ipc/unix_socket.cc",
+    "src/protozero/proto_utils.cc",
+    "src/protozero/protozero_message.cc",
+    "src/protozero/protozero_message_handle.cc",
+    "src/protozero/scattered_stream_writer.cc",
+    "src/tracing/core/chunked_protobuf_input_stream.cc",
+    "src/tracing/core/data_source_config.cc",
+    "src/tracing/core/data_source_descriptor.cc",
+    "src/tracing/core/id_allocator.cc",
+    "src/tracing/core/service_impl.cc",
+    "src/tracing/core/shared_memory_abi.cc",
+    "src/tracing/core/shared_memory_arbiter.cc",
+    "src/tracing/core/trace_config.cc",
+    "src/tracing/core/trace_packet.cc",
+    "src/tracing/core/trace_writer_impl.cc",
+    "src/tracing/test/consumer_cmd.cc",
+  ],
+  shared_libs: [
+    "libandroid",
+    "liblog",
+    "libprotobuf-cpp-lite",
+  ],
+  static_libs: [
+    "libgtest_prod",
+    "perfetto_src_tracing_ipc",
+  ],
+  generated_headers: [
+    "perfetto_protos_ftrace_lite_gen_headers",
+    "perfetto_protos_ftrace_zero_gen_headers",
+    "perfetto_protos_lite_gen_headers",
+    "perfetto_protos_tracing_service_lite_gen_headers",
+    "perfetto_protos_tracing_service_tracing_service_gen_headers",
+    "perfetto_protos_zero_gen_headers",
+    "perfetto_src_ipc_wire_protocol_gen_headers",
+  ],
+  defaults: [
+    "perfetto_defaults",
+  ],
+}
+
+// GN target: //:traced
+cc_binary {
+  name: "traced",
+  srcs: [
+    ":perfetto_protos_ftrace_lite_gen",
+    ":perfetto_protos_ftrace_zero_gen",
+    ":perfetto_protos_lite_gen",
+    ":perfetto_protos_tracing_service_lite_gen",
+    ":perfetto_protos_tracing_service_tracing_service_gen",
+    ":perfetto_protos_zero_gen",
+    ":perfetto_src_ipc_wire_protocol_gen",
+    "src/base/android_task_runner.cc",
+    "src/base/page_allocator.cc",
+    "src/base/thread_checker.cc",
+    "src/base/unix_task_runner.cc",
+    "src/ftrace_reader/cpu_reader.cc",
+    "src/ftrace_reader/event_info.cc",
+    "src/ftrace_reader/format_parser.cc",
+    "src/ftrace_reader/ftrace_controller.cc",
+    "src/ftrace_reader/ftrace_procfs.cc",
+    "src/ftrace_reader/ftrace_to_proto.cc",
+    "src/ftrace_reader/proto_translation_table.cc",
+    "src/ipc/buffered_frame_deserializer.cc",
+    "src/ipc/client_impl.cc",
+    "src/ipc/deferred.cc",
+    "src/ipc/host_impl.cc",
+    "src/ipc/service_proxy.cc",
+    "src/ipc/unix_socket.cc",
+    "src/protozero/proto_utils.cc",
+    "src/protozero/protozero_message.cc",
+    "src/protozero/protozero_message_handle.cc",
+    "src/protozero/scattered_stream_writer.cc",
+    "src/traced/probes/probes.cc",
+    "src/traced/service/service.cc",
+    "src/traced/traced.cc",
+    "src/tracing/core/chunked_protobuf_input_stream.cc",
+    "src/tracing/core/data_source_config.cc",
+    "src/tracing/core/data_source_descriptor.cc",
+    "src/tracing/core/id_allocator.cc",
+    "src/tracing/core/service_impl.cc",
+    "src/tracing/core/shared_memory_abi.cc",
+    "src/tracing/core/shared_memory_arbiter.cc",
+    "src/tracing/core/trace_config.cc",
+    "src/tracing/core/trace_packet.cc",
+    "src/tracing/core/trace_writer_impl.cc",
+  ],
+  shared_libs: [
+    "libandroid",
+    "liblog",
+    "libprotobuf-cpp-lite",
+  ],
+  static_libs: [
+    "libgtest_prod",
+    "perfetto_src_tracing_ipc",
+  ],
+  generated_headers: [
+    "perfetto_protos_ftrace_lite_gen_headers",
+    "perfetto_protos_ftrace_zero_gen_headers",
+    "perfetto_protos_lite_gen_headers",
+    "perfetto_protos_tracing_service_lite_gen_headers",
+    "perfetto_protos_tracing_service_tracing_service_gen_headers",
+    "perfetto_protos_zero_gen_headers",
+    "perfetto_src_ipc_wire_protocol_gen_headers",
+  ],
+  defaults: [
+    "perfetto_defaults",
+  ],
+}