Merge changes I6c1ce353,Ifbc186e9,I054a6b55,I4ef58164,I7a90c661, ...

* changes:
  gn2bp: Fix output for protoc_wrapper.py
  gn2bp: Set --py-out-dir arg in protoc_wrapper.py
  gn2bp: Set --include arg in protoc_wrapper.py
  gn2bp: Fix dllexport_decl arg in protoc_wrapper.py
  gn2bp: Set --cc-out-dir arg for protoc_wrapper.py
  gn2bp: Set --proto-in-dir arg for protoc_wrapper.py
  gn2bp: Use aprotoc in protoc_wrapper.py
  gn2bp: Add protoc to builtin_deps
  gn2bp: Update not to change Android.bp.swp every run
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index 42de957..a86eea4 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -3092,32 +3092,32 @@
 genrule {
     name: "cronet_aml_net_base_registry_controlled_domains_registry_controlled_domains",
     cmd: "$(location net/tools/dafsa/make_dafsa.py) --reverse " +
-         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest5.gperf) " +
-         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest5-reversed-inc.cc) " +
-         "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
-         "--reverse " +
-         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest2.gperf) " +
-         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest2-reversed-inc.cc) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names.gperf) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names-reversed-inc.cc) " +
          "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
          "--reverse " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest1.gperf) " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest1-reversed-inc.cc) " +
          "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
          "--reverse " +
-         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest6.gperf) " +
-         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest6-reversed-inc.cc) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest2.gperf) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest2-reversed-inc.cc) " +
          "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
          "--reverse " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest3.gperf) " +
          "$(location net/base/registry_controlled_domains/effective_tld_names_unittest3-reversed-inc.cc) " +
          "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
          "--reverse " +
-         "$(location net/base/registry_controlled_domains/effective_tld_names.gperf) " +
-         "$(location net/base/registry_controlled_domains/effective_tld_names-reversed-inc.cc) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest4.gperf) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest4-reversed-inc.cc) " +
          "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
          "--reverse " +
-         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest4.gperf) " +
-         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest4-reversed-inc.cc)",
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest5.gperf) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest5-reversed-inc.cc) " +
+         "&& python3 $(location net/tools/dafsa/make_dafsa.py) " +
+         "--reverse " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest6.gperf) " +
+         "$(location net/base/registry_controlled_domains/effective_tld_names_unittest6-reversed-inc.cc)",
     out: [
         "net/base/registry_controlled_domains/effective_tld_names-reversed-inc.cc",
         "net/base/registry_controlled_domains/effective_tld_names_unittest1-reversed-inc.cc",
@@ -3213,17 +3213,20 @@
     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 " +
+         "`dirname $(location net/cert/root_store.proto)` " +
          "--cc-out-dir " +
          "clang_x64/gen/net/cert/root_store_proto_full/ " +
          "--py-out-dir " +
-         "clang_x64/pyproto/net/cert/root_store_proto_full/",
+         "$(genDir)/clang_x64/pyproto/net/cert/root_store_proto_full/",
     out: [
-        "//out/test/clang_x64/pyproto/net/cert/root_store_proto_full/root_store_pb2.py",
+        "clang_x64/pyproto/net/cert/root_store_proto_full/root_store_pb2.py",
         "net/cert/root_store_proto_full/root_store.pb.cc",
         "net/cert/root_store_proto_full/root_store.pb.h",
     ],
@@ -3420,19 +3423,22 @@
     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 " +
+         "`dirname $(location net/base/isolation_info.proto)` " +
          "--cc-out-dir " +
-         "gen/net/base " +
+         "$(genDir)/net/base " +
          "--py-out-dir " +
-         "pyproto/net/base",
+         "$(genDir)/pyproto/net/base",
     out: [
-        "//out/test/pyproto/net/base/isolation_info_pb2.py",
         "net/base/isolation_info.pb.cc",
         "net/base/isolation_info.pb.h",
+        "pyproto/net/base/isolation_info_pb2.py",
     ],
     tool_files: [
         "tools/protoc_wrapper/protoc_wrapper.py",
@@ -4196,26 +4202,30 @@
 genrule {
     name: "cronet_aml_net_net_nqe_proto_gen",
     srcs: [
+        "net/base/net_export.h",
         "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 " +
+         "`dirname $(location net/nqe/proto/network_id_proto.proto)` " +
          "--cc-out-dir " +
-         "gen/net/nqe/proto " +
+         "$(genDir)/net/nqe/proto " +
          "--cc-options " +
-         "dllexport_decl " +
-         "NET_EXPORT_PRIVATE: " +
+         "dllexport_decl=NET_EXPORT_PRIVATE: " +
+         " " +
          "--include " +
-         "net/base/net_export.h " +
+         "$(location net/base/net_export.h) " +
          "--py-out-dir " +
-         "pyproto/net/nqe/proto",
+         "$(genDir)/pyproto/net/nqe/proto",
     out: [
-        "//out/test/pyproto/net/nqe/proto/network_id_proto_pb2.py",
         "net/nqe/proto/network_id_proto.pb.cc",
         "net/nqe/proto/network_id_proto.pb.h",
+        "pyproto/net/nqe/proto/network_id_proto_pb2.py",
     ],
     tool_files: [
         "tools/protoc_wrapper/protoc_wrapper.py",
@@ -4415,36 +4425,40 @@
 genrule {
     name: "cronet_aml_net_third_party_quiche_net_quic_proto_gen",
     srcs: [
+        "base/component_export.h",
         "net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters.proto",
         "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 " +
+         "`dirname $(location net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters.proto)`/../../../../ " +
          "--cc-out-dir " +
-         "gen/net/third_party/quiche/src " +
+         "$(genDir)/net/third_party/quiche/src " +
          "--cc-options " +
-         "dllexport_decl " +
-         "COMPONENT_EXPORT(QUICHE): " +
+         "dllexport_decl=COMPONENT_EXPORT(QUICHE): " +
+         " " +
          "--include " +
-         "base/component_export.h " +
+         "$(location base/component_export.h) " +
          "--py-out-dir " +
-         "pyproto/net/third_party/quiche/src",
+         "$(genDir)/pyproto/net/third_party/quiche/src",
     out: [
-        "//out/test/pyproto/net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters_pb2.py",
-        "//out/test/pyproto/net/third_party/quiche/src/quiche/quic/core/proto/crypto_server_config_pb2.py",
-        "//out/test/pyproto/net/third_party/quiche/src/quiche/quic/core/proto/source_address_token_pb2.py",
         "net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters.pb.cc",
         "net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters.pb.h",
         "net/third_party/quiche/src/quiche/quic/core/proto/crypto_server_config.pb.cc",
         "net/third_party/quiche/src/quiche/quic/core/proto/crypto_server_config.pb.h",
         "net/third_party/quiche/src/quiche/quic/core/proto/source_address_token.pb.cc",
         "net/third_party/quiche/src/quiche/quic/core/proto/source_address_token.pb.h",
+        "pyproto/net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters_pb2.py",
+        "pyproto/net/third_party/quiche/src/quiche/quic/core/proto/crypto_server_config_pb2.py",
+        "pyproto/net/third_party/quiche/src/quiche/quic/core/proto/source_address_token_pb2.py",
     ],
     tool_files: [
         "tools/protoc_wrapper/protoc_wrapper.py",
@@ -4504,26 +4518,30 @@
 genrule {
     name: "cronet_aml_net_third_party_quiche_net_quic_test_tools_proto_gen",
     srcs: [
+        "net/base/net_export.h",
         "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 " +
+         "`dirname $(location net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.proto)` " +
          "--cc-out-dir " +
-         "gen/net/third_party/quiche/src/quiche/quic/test_tools " +
+         "$(genDir)/net/third_party/quiche/src/quiche/quic/test_tools " +
          "--cc-options " +
-         "dllexport_decl " +
-         "NET_EXPORT_PRIVATE: " +
+         "dllexport_decl=NET_EXPORT_PRIVATE: " +
+         " " +
          "--include " +
-         "net/base/net_export.h " +
+         "$(location net/base/net_export.h) " +
          "--py-out-dir " +
-         "pyproto/net/third_party/quiche/src/quiche/quic/test_tools",
+         "$(genDir)/pyproto/net/third_party/quiche/src/quiche/quic/test_tools",
     out: [
-        "//out/test/pyproto/net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result_pb2.py",
         "net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.pb.cc",
         "net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.pb.h",
+        "pyproto/net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result_pb2.py",
     ],
     tool_files: [
         "tools/protoc_wrapper/protoc_wrapper.py",
@@ -9601,190 +9619,6 @@
     cpp_std: "c++20",
 }
 
-// GN: //third_party/protobuf:protoc
-cc_binary {
-    name: "cronet_aml_third_party_protobuf_protoc",
-    srcs: [
-        ":cronet_aml_buildtools_third_party_libc___libc__",
-        ":cronet_aml_buildtools_third_party_libc__abi_libc__abi",
-        "third_party/protobuf/src/google/protobuf/compiler/main.cc",
-    ],
-    static_libs: [
-        "cronet_aml_third_party_protobuf_protoc_lib",
-    ],
-    defaults: [
-        "cronet_aml_defaults",
-    ],
-    cflags: [
-        "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
-        "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
-        "-DCR_SYSROOT_KEY=20220331T153654Z-0",
-        "-DDCHECK_ALWAYS_ON=1",
-        "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
-        "-DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0",
-        "-DGOOGLE_PROTOBUF_NO_RTTI",
-        "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
-        "-DHAVE_PTHREAD",
-        "-DLIBCXXABI_SILENT_TERMINATE",
-        "-DLIBCXX_BUILDING_LIBCXXABI",
-        "-DUSE_AURA=1",
-        "-DUSE_OZONE=1",
-        "-DUSE_UDEV",
-        "-D_DEBUG",
-        "-D_FILE_OFFSET_BITS=64",
-        "-D_GNU_SOURCE",
-        "-D_LARGEFILE64_SOURCE",
-        "-D_LARGEFILE_SOURCE",
-        "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
-        "-D_LIBCPP_BUILDING_LIBRARY",
-        "-D_LIBCPP_CONSTINIT=constinit",
-        "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
-        "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
-        "-D_LIBCPP_OVERRIDABLE_FUNC_VIS=__attribute__((__visibility__(\"default\")))",
-        "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
-    ],
-    local_include_dirs: [
-        "./",
-        "buildtools/third_party/libc++/",
-        "buildtools/third_party/libc++/trunk/include",
-        "buildtools/third_party/libc++/trunk/src/",
-        "buildtools/third_party/libc++abi/trunk/include",
-        "third_party/protobuf/src/",
-        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
-    ],
-    cpp_std: "c++20",
-}
-
-// GN: //third_party/protobuf:protoc_lib
-cc_library_static {
-    name: "cronet_aml_third_party_protobuf_protoc_lib",
-    srcs: [
-        "third_party/protobuf/src/google/protobuf/compiler/code_generator.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_enum.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_enum_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_helpers.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_message_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_context.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_doc_comment.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_enum.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_enum_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_enum_lite.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_extension.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_extension_lite.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_file.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_generator.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_kotlin_generator.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_map_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_map_field_lite.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_message.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_message_builder.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_message_builder_lite.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_message_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_message_field_lite.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_message_lite.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_name_resolver.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_primitive_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_primitive_field_lite.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_service.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_string_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/java/java_string_field_lite.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/js/js_generator.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/js/well_known_types_embed.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/php/php_generator.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/plugin.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/python/python_generator.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/python/python_helpers.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/python/python_pyi_generator.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/subprocess.cc",
-        "third_party/protobuf/src/google/protobuf/compiler/zip_writer.cc",
-    ],
-    static_libs: [
-        "cronet_aml_third_party_protobuf_protobuf_full",
-    ],
-    defaults: [
-        "cronet_aml_defaults",
-    ],
-    cflags: [
-        "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
-        "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
-        "-DCR_SYSROOT_KEY=20220331T153654Z-0",
-        "-DDCHECK_ALWAYS_ON=1",
-        "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
-        "-DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0",
-        "-DGOOGLE_PROTOBUF_NO_RTTI",
-        "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
-        "-DHAVE_PTHREAD",
-        "-DUSE_AURA=1",
-        "-DUSE_OZONE=1",
-        "-DUSE_UDEV",
-        "-D_DEBUG",
-        "-D_FILE_OFFSET_BITS=64",
-        "-D_GNU_SOURCE",
-        "-D_LARGEFILE64_SOURCE",
-        "-D_LARGEFILE_SOURCE",
-        "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
-        "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
-        "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
-        "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
-    ],
-    local_include_dirs: [
-        "./",
-        "buildtools/third_party/libc++/",
-        "buildtools/third_party/libc++/trunk/include",
-        "buildtools/third_party/libc++abi/trunk/include",
-        "third_party/protobuf/src/",
-        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
-    ],
-    cpp_std: "c++20",
-}
-
 // GN: //third_party/zlib:zlib
 cc_library_static {
     name: "cronet_aml_third_party_zlib_zlib",
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 7487287..f157b22 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -221,6 +221,8 @@
         enable_uapi_headers,
     '//src/profiling/memory:bionic_libc_platform_headers_on_android':
         enable_bionic_libc_platform_headers_on_android,
+    '//third_party/protobuf:protoc':
+      lambda x: None,
 }
 
 # ----------------------------------------------------------------------------
@@ -706,7 +708,7 @@
   So each source file will generate an output whose name is the {source_name-reversed-inc.cc}
   """
   new_args = []
-  for i, src in enumerate(target.sources):
+  for i, src in enumerate(sorted(target.sources)):
     # don't add script arg for the first source -- create_action_module
     # already does this.
     if i != 0:
@@ -854,6 +856,36 @@
     # 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")
+    target.outputs = [re.sub('^//out/test/', '', out) for out in target.outputs]
+    for i, val in enumerate(target.args):
+      if val == '--protoc':
+        target.args[i + 1] = '$(location aprotoc)'
+      elif val == '--proto-in-dir':
+        # Proto files in the cmd is relative path from --proto-in-dir
+        # Proto files are specified as filenames without directory except net_quic_proto_gen
+        # So getting directory from source file
+        proto_file = gn_utils.label_to_path(sorted(list(target.sources))[0])
+        target.args[i + 1] = '`dirname $(location %s)`' % proto_file
+        # Adjusting path for net_quic_proto_gen
+        if target.name == "//net/third_party/quiche:net_quic_proto_gen":
+          target.args[i + 1] += '/../../../../'
+      elif val == '--cc-out-dir':
+        target.args[i + 1] = re.sub('^gen', '$(genDir)', target.args[i + 1])
+      elif val == 'dllexport_decl':
+        # Needs to be dllexport_decl=value format
+        target.args[i] += '=' + target.args[i+1]
+        target.args[i+1] = ''
+      elif val == '--include':
+        # This file can be got from filegroup this target depends on, but currently we don't add .h
+        # files to the srcs. So far this is the only case .h files need to be added to the srcs.
+        # So, for now, adding specific for this target.
+        module.srcs.add(target.args[i+1])
+        target.args[i + 1] = '$(location %s)' % target.args[i + 1]
+      elif val == "--py-out-dir":
+        target.args[i + 1] = '$(genDir)/' + target.args[i + 1]
 
   script = gn_utils.label_to_path(target.script)
   module.tool_files.add(script)