tp: switch from using libprotoc to libprotobuf-full

While shell does compile protos, it only uses the compiler class which
is part of libprotobuf full and does not need the full baggage of
libprotoc.

This is necessary because when we build TP for Android devices in the
Android tree, we cannnot depend on libprotoc as it is a host-only
library.

Bug: 168055856
Change-Id: I49e501ee25385ae176ebd781c41caff4551e85bf
diff --git a/Android.bp b/Android.bp
index de6fd23..746aea0 100644
--- a/Android.bp
+++ b/Android.bp
@@ -8324,7 +8324,7 @@
     "src/trace_processor/util/proto_to_json.cc",
   ],
   static_libs: [
-    "libprotoc",
+    "libprotobuf-cpp-full",
     "libsqlite",
     "libz",
   ],
@@ -8443,10 +8443,8 @@
     ":perfetto_tools_trace_to_text_pprofbuilder",
     ":perfetto_tools_trace_to_text_utils",
   ],
-  shared_libs: [
-    "libprotobuf-cpp-full",
-  ],
   static_libs: [
+    "libprotobuf-cpp-full",
     "libsqlite",
     "libz",
   ],
diff --git a/BUILD b/BUILD
index 43b4b84..9839996 100644
--- a/BUILD
+++ b/BUILD
@@ -3124,7 +3124,7 @@
                ":src_trace_processor_metrics_gen_cc_metrics_descriptor",
            ] + PERFETTO_CONFIG.deps.jsoncpp +
            PERFETTO_CONFIG.deps.linenoise +
-           PERFETTO_CONFIG.deps.protoc_lib +
+           PERFETTO_CONFIG.deps.protobuf_full +
            PERFETTO_CONFIG.deps.sqlite +
            PERFETTO_CONFIG.deps.sqlite_ext_percentile +
            PERFETTO_CONFIG.deps.zlib + [
diff --git a/gn/BUILD.gn b/gn/BUILD.gn
index 30d8469..236e19d 100644
--- a/gn/BUILD.gn
+++ b/gn/BUILD.gn
@@ -232,12 +232,10 @@
 
 group("protobuf_full") {
   visibility = protobuf_full_deps_allowlist
-  if (current_toolchain == host_toolchain) {
-    if (perfetto_use_system_protobuf) {
-      public_configs = [ ":system_protobuf" ]
-    } else {
-      public_deps = [ "${perfetto_protobuf_target_prefix}:protobuf_full" ]
-    }
+  if (perfetto_use_system_protobuf) {
+    public_configs = [ ":system_protobuf" ]
+  } else {
+    public_deps = [ "${perfetto_protobuf_target_prefix}:protobuf_full" ]
   }
 }
 
diff --git a/src/trace_processor/BUILD.gn b/src/trace_processor/BUILD.gn
index 5559f30..69da843 100644
--- a/src/trace_processor/BUILD.gn
+++ b/src/trace_processor/BUILD.gn
@@ -337,7 +337,7 @@
     deps = [
       ":lib",
       "../../gn:default_deps",
-      "../../gn:protoc_lib",
+      "../../gn:protobuf_full",
       "../../src/profiling/symbolizer",
       "../../src/profiling/symbolizer:symbolize_database",
       "../base",
diff --git a/tools/gen_android_bp b/tools/gen_android_bp
index 80a1985..b242ac3 100755
--- a/tools/gen_android_bp
+++ b/tools/gen_android_bp
@@ -227,7 +227,10 @@
 
 
 def enable_protobuf_full(module):
-  module.shared_libs.add('libprotobuf-cpp-full')
+  if module.type == 'cc_binary_host':
+    module.static_libs.add('libprotobuf-cpp-full')
+  else:
+    module.shared_libs.add('libprotobuf-cpp-full')
 
 
 def enable_protobuf_lite(module):