gn2bp: Use aprotoc in protoc_wrapper.py

Test: ./update_result.sh
Change-Id: I050ca54ca3f98a0fc6ced1f603b1db502c0a189c
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index 1777802..c479c18 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -3213,9 +3213,12 @@
     srcs: [
         "net/cert/root_store.proto",
     ],
+    tools: [
+        "aprotoc",
+    ],
     cmd: "$(location tools/protoc_wrapper/protoc_wrapper.py) root_store.proto " +
          "--protoc " +
-         "./clang_x64/protoc " +
+         "$(location aprotoc) " +
          "--proto-in-dir " +
          "../../net/cert " +
          "--cc-out-dir " +
@@ -3420,9 +3423,12 @@
     srcs: [
         "net/base/isolation_info.proto",
     ],
+    tools: [
+        "aprotoc",
+    ],
     cmd: "$(location tools/protoc_wrapper/protoc_wrapper.py) isolation_info.proto " +
          "--protoc " +
-         "./clang_x64/protoc " +
+         "$(location aprotoc) " +
          "--proto-in-dir " +
          "../../net/base " +
          "--cc-out-dir " +
@@ -4198,9 +4204,12 @@
     srcs: [
         "net/nqe/proto/network_id_proto.proto",
     ],
+    tools: [
+        "aprotoc",
+    ],
     cmd: "$(location tools/protoc_wrapper/protoc_wrapper.py) network_id_proto.proto " +
          "--protoc " +
-         "./clang_x64/protoc " +
+         "$(location aprotoc) " +
          "--proto-in-dir " +
          "../../net/nqe/proto " +
          "--cc-out-dir " +
@@ -4419,11 +4428,14 @@
         "net/third_party/quiche/src/quiche/quic/core/proto/crypto_server_config.proto",
         "net/third_party/quiche/src/quiche/quic/core/proto/source_address_token.proto",
     ],
+    tools: [
+        "aprotoc",
+    ],
     cmd: "$(location tools/protoc_wrapper/protoc_wrapper.py) quiche/quic/core/proto/cached_network_parameters.proto " +
          "quiche/quic/core/proto/crypto_server_config.proto " +
          "quiche/quic/core/proto/source_address_token.proto " +
          "--protoc " +
-         "./clang_x64/protoc " +
+         "$(location aprotoc) " +
          "--proto-in-dir " +
          "../../net/third_party/quiche/src " +
          "--cc-out-dir " +
@@ -4506,9 +4518,12 @@
     srcs: [
         "net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.proto",
     ],
+    tools: [
+        "aprotoc",
+    ],
     cmd: "$(location tools/protoc_wrapper/protoc_wrapper.py) send_algorithm_test_result.proto " +
          "--protoc " +
-         "./clang_x64/protoc " +
+         "$(location aprotoc) " +
          "--proto-in-dir " +
          "../../net/third_party/quiche/src/quiche/quic/test_tools " +
          "--cc-out-dir " +
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 3811c3a..33d1b71 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -856,6 +856,12 @@
     # Specifying file under $(genDir) so that parent directory exists.
     # If this file is used by other module, we may need to add this file to the outputs.
     target.args[2] = '$(genDir)/' + target.args[2].split('/')[-1]
+  elif target.script == "//tools/protoc_wrapper/protoc_wrapper.py":
+    # Use protoc in the android
+    module.tools.add("aprotoc")
+    for i, val in enumerate(target.args):
+      if val == '--protoc':
+        target.args[i + 1] = '$(location aprotoc)'
 
   script = gn_utils.label_to_path(target.script)
   module.tool_files.add(script)