Support building trace_to_text in the Android tree

Bug: 73611302
Test: manual
Change-Id: I93934ca6a2af050700f34dbb73139d01b570c47d
diff --git a/BUILD.gn b/BUILD.gn
index 39a4946..1207331 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -35,8 +35,10 @@
       "test/configs",
       "tools:protoc_helper",
       "tools/proto_to_cpp",
-      "tools/trace_to_text",
     ]
+    if (!build_with_android) {
+      deps += [ "tools/trace_to_text" ]
+    }
     if (is_linux || is_android) {
       deps += [
         ":perfetto",
@@ -165,6 +167,16 @@
     }
   }
 
+  if (build_with_android) {
+    executable("trace_to_text") {
+      testonly = true
+      deps = [
+        "gn:default_deps",
+        "tools/trace_to_text:lib",
+      ]
+    }
+  }
+
   # This target exports perfetto trace protos in the Android build system,
   # allowing both host and device targets to implement custom parsers based on
   # our protos.