Make trace_processor a host-only target

The trace_processor_shell target is currently very confusing:
it pretends to be a host + device target, but in reality it uses
libprotobuf-full and libprotoc (for dynamic metrics .proto loading)
which is forbidden on-device.
This CL clearly makes trace_processor a host-only target. It also
cleans up some GN files, removing the testonly attribute (and
related hacks in gen_android_bp) and restricting protobuf-full to
host tools only via visibility rules.
It also makes the dependency on libprotoc explicit. It will be
needed by Bazel builds.

Bug: 140126865
Change-Id: Ic8a7827ae83d0ef6c4a607566c732a8798379762
diff --git a/buildtools/BUILD.gn b/buildtools/BUILD.gn
index cdbdb6a..220fb8b 100644
--- a/buildtools/BUILD.gn
+++ b/buildtools/BUILD.gn
@@ -273,111 +273,111 @@
   public_configs = [ ":protobuf_gen_config" ]
 }
 
-if (current_toolchain == host_toolchain) {
-  source_set("protoc_lib") {
-    visibility = _buildtools_visibility
-    deps = [
-      ":protobuf_full",
-      "//gn:default_deps",
-    ]
-    sources = [
-      "protobuf/src/google/protobuf/compiler/code_generator.cc",
-      "protobuf/src/google/protobuf/compiler/command_line_interface.cc",
-      "protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc",
-      "protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc",
-      "protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc",
-      "protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc",
-      "protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc",
-      "protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc",
-      "protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc",
-      "protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.cc",
-      "protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc",
-      "protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc",
-      "protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
-      "protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc",
-      "protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc",
-      "protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc",
-      "protobuf/src/google/protobuf/compiler/csharp/csharp_enum.cc",
-      "protobuf/src/google/protobuf/compiler/csharp/csharp_enum_field.cc",
-      "protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.cc",
-      "protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc",
-      "protobuf/src/google/protobuf/compiler/csharp/csharp_helpers.cc",
-      "protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.cc",
-      "protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc",
-      "protobuf/src/google/protobuf/compiler/csharp/csharp_message_field.cc",
-      "protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc",
-      "protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc",
-      "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc",
-      "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc",
-      "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc",
-      "protobuf/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc",
-      "protobuf/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_context.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_doc_comment.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_enum.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_enum_field.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_enum_lite.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_extension.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_extension_lite.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_field.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_file.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_generator.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_helpers.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_lazy_message_field.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_map_field.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_map_field_lite.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_message.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_message_builder.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_message_builder_lite.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_message_field.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_message_field_lite.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_message_lite.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_name_resolver.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_primitive_field.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_primitive_field_lite.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_service.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_string_field.cc",
-      "protobuf/src/google/protobuf/compiler/java/java_string_field_lite.cc",
-      "protobuf/src/google/protobuf/compiler/javanano/javanano_enum.cc",
-      "protobuf/src/google/protobuf/compiler/javanano/javanano_enum_field.cc",
-      "protobuf/src/google/protobuf/compiler/javanano/javanano_extension.cc",
-      "protobuf/src/google/protobuf/compiler/javanano/javanano_field.cc",
-      "protobuf/src/google/protobuf/compiler/javanano/javanano_file.cc",
-      "protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc",
-      "protobuf/src/google/protobuf/compiler/javanano/javanano_helpers.cc",
-      "protobuf/src/google/protobuf/compiler/javanano/javanano_map_field.cc",
-      "protobuf/src/google/protobuf/compiler/javanano/javanano_message.cc",
-      "protobuf/src/google/protobuf/compiler/javanano/javanano_message_field.cc",
-      "protobuf/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc",
-      "protobuf/src/google/protobuf/compiler/js/js_generator.cc",
-      "protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.cc",
-      "protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc",
-      "protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.cc",
-      "protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.cc",
-      "protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.cc",
-      "protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.cc",
-      "protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc",
-      "protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc",
-      "protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.cc",
-      "protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc",
-      "protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc",
-      "protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc",
-      "protobuf/src/google/protobuf/compiler/plugin.cc",
-      "protobuf/src/google/protobuf/compiler/plugin.pb.cc",
-      "protobuf/src/google/protobuf/compiler/python/python_generator.cc",
-      "protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc",
-      "protobuf/src/google/protobuf/compiler/subprocess.cc",
-      "protobuf/src/google/protobuf/compiler/zip_writer.cc",
-    ]
-    configs -= [ "//gn/standalone:extra_warnings" ]
-    configs += [ ":protobuf_config" ]
-    public_configs = [ ":protobuf_gen_config" ]
-  }
+source_set("protoc_lib") {
+  visibility = _buildtools_visibility
+  deps = [
+    ":protobuf_full",
+    "//gn:default_deps",
+  ]
+  sources = [
+    "protobuf/src/google/protobuf/compiler/code_generator.cc",
+    "protobuf/src/google/protobuf/compiler/command_line_interface.cc",
+    "protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc",
+    "protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc",
+    "protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc",
+    "protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc",
+    "protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc",
+    "protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc",
+    "protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc",
+    "protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.cc",
+    "protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc",
+    "protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc",
+    "protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
+    "protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc",
+    "protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc",
+    "protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc",
+    "protobuf/src/google/protobuf/compiler/csharp/csharp_enum.cc",
+    "protobuf/src/google/protobuf/compiler/csharp/csharp_enum_field.cc",
+    "protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.cc",
+    "protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc",
+    "protobuf/src/google/protobuf/compiler/csharp/csharp_helpers.cc",
+    "protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.cc",
+    "protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc",
+    "protobuf/src/google/protobuf/compiler/csharp/csharp_message_field.cc",
+    "protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc",
+    "protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc",
+    "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc",
+    "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc",
+    "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc",
+    "protobuf/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc",
+    "protobuf/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_context.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_doc_comment.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_enum.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_enum_field.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_enum_lite.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_extension.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_extension_lite.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_field.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_file.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_generator.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_helpers.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_lazy_message_field.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_map_field.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_map_field_lite.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_message.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_message_builder.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_message_builder_lite.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_message_field.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_message_field_lite.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_message_lite.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_name_resolver.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_primitive_field.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_primitive_field_lite.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_service.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_string_field.cc",
+    "protobuf/src/google/protobuf/compiler/java/java_string_field_lite.cc",
+    "protobuf/src/google/protobuf/compiler/javanano/javanano_enum.cc",
+    "protobuf/src/google/protobuf/compiler/javanano/javanano_enum_field.cc",
+    "protobuf/src/google/protobuf/compiler/javanano/javanano_extension.cc",
+    "protobuf/src/google/protobuf/compiler/javanano/javanano_field.cc",
+    "protobuf/src/google/protobuf/compiler/javanano/javanano_file.cc",
+    "protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc",
+    "protobuf/src/google/protobuf/compiler/javanano/javanano_helpers.cc",
+    "protobuf/src/google/protobuf/compiler/javanano/javanano_map_field.cc",
+    "protobuf/src/google/protobuf/compiler/javanano/javanano_message.cc",
+    "protobuf/src/google/protobuf/compiler/javanano/javanano_message_field.cc",
+    "protobuf/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc",
+    "protobuf/src/google/protobuf/compiler/js/js_generator.cc",
+    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.cc",
+    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc",
+    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.cc",
+    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.cc",
+    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.cc",
+    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.cc",
+    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc",
+    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc",
+    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.cc",
+    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc",
+    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc",
+    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc",
+    "protobuf/src/google/protobuf/compiler/plugin.cc",
+    "protobuf/src/google/protobuf/compiler/plugin.pb.cc",
+    "protobuf/src/google/protobuf/compiler/python/python_generator.cc",
+    "protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc",
+    "protobuf/src/google/protobuf/compiler/subprocess.cc",
+    "protobuf/src/google/protobuf/compiler/zip_writer.cc",
+  ]
+  configs -= [ "//gn/standalone:extra_warnings" ]
+  configs += [ ":protobuf_config" ]
+  public_configs = [ ":protobuf_gen_config" ]
+}
 
+if (current_toolchain == host_toolchain) {
   executable("protoc") {
     visibility = _buildtools_visibility
     deps = [