Automated rollback of commit 4abd199841.

PiperOrigin-RevId: 683793486
pull/35985/head^2
AJ Heller 2 months ago committed by Copybara-Service
parent 7bdfd32f46
commit b41b323fbe
  1. 133
      BUILD
  2. 938
      CMakeLists.txt
  3. 1
      Makefile
  4. 1
      Package.swift
  5. 10
      WORKSPACE
  6. 765
      build_autogenerated.yaml
  7. 2
      config.m4
  8. 2
      config.w32
  9. 61
      gRPC-C++.podspec
  10. 1
      gRPC-Core.podspec
  11. 1
      grpc.gemspec
  12. 1
      include/grpc/support/port_platform.h
  13. 82
      include/grpcpp/security/binder_security_policy.h
  14. 1
      package.xml
  15. 32
      src/core/BUILD
  16. 10
      src/core/ext/transport/binder/README.md
  17. 42
      src/core/ext/transport/binder/client/channel_create_impl.h
  18. 69
      src/core/ext/transport/binder/client/connection_id_generator.cc
  19. 0
      src/core/ext/transport/binder/java/WORKSPACE
  20. 30
      src/core/ext/transport/binder/java/io/grpc/binder/cpp/BUILD
  21. 104
      src/core/ext/transport/binder/java/io/grpc/binder/cpp/GrpcBinderConnection.java
  22. 40
      src/core/ext/transport/binder/java/io/grpc/binder/cpp/GrpcCppServerBuilder.java
  23. 71
      src/core/ext/transport/binder/java/io/grpc/binder/cpp/NativeConnectionHelper.java
  24. 40
      src/core/ext/transport/binder/security_policy/security_policy.h
  25. 117
      src/core/ext/transport/binder/transport/binder_stream.h
  26. 76
      src/core/ext/transport/binder/utils/binder_auto_utils.h
  27. 107
      src/core/ext/transport/binder/utils/ndk_binder.h
  28. 29
      src/core/ext/transport/binder/wire_format/binder_constants.cc
  29. 33
      src/core/ext/transport/binder/wire_format/transaction.cc
  30. 6
      src/core/plugin_registry/grpc_plugin_registry.cc
  31. 9
      src/core/resolver/binder/README.md
  32. 1
      src/python/grpcio/grpc_core_dependencies.py
  33. 16
      test/core/resolver/BUILD
  34. 133
      test/core/transport/binder/BUILD
  35. 119
      test/core/transport/binder/end2end/BUILD
  36. 101
      test/core/transport/binder/end2end/fuzzers/BUILD
  37. 0
      test/core/transport/binder/end2end/fuzzers/binder_transport_client_fuzzer_corpus/empty
  38. 81
      test/core/transport/binder/end2end/fuzzers/binder_transport_fuzzer.proto
  39. 0
      test/core/transport/binder/end2end/fuzzers/binder_transport_server_fuzzer_corpus/empty
  40. 17
      test/core/transport/binder/end2end/fuzzers/client.proto
  41. 157
      test/core/transport/binder/end2end/fuzzers/fuzzer_utils.cc
  42. 17
      test/core/transport/binder/end2end/fuzzers/server.proto
  43. 55
      test/core/transport/binder/mock_objects.cc
  44. 121
      test/core/transport/binder/mock_objects.h
  45. 3
      tools/doxygen/Doxyfile.c++
  46. 42
      tools/doxygen/Doxyfile.c++.internal
  47. 3
      tools/doxygen/Doxyfile.core.internal
  48. 40
      tools/internal_ci/linux/grpc_binder_transport_apk_build_in_docker.sh
  49. 192
      tools/run_tests/generated/tests.json

133
BUILD

@ -74,6 +74,17 @@ config_setting(
flag_values = {":disable_grpc_rls": "true"},
)
# When gRPC is build as shared library, binder transport code might still
# get included even when user's code does not depend on it. In that case
# --define=grpc_no_binder=true can be used to disable binder transport
# related code to reduce binary size.
# For users using build system other than bazel, they can define
# GRPC_NO_BINDER to achieve the same effect.
config_setting(
name = "grpc_no_binder_define",
values = {"define": "grpc_no_binder=true"},
)
config_setting(
name = "android",
values = {"crosstool_top": "//external:android/crosstool"},
@ -124,6 +135,15 @@ selects.config_setting_group(
],
)
selects.config_setting_group(
name = "grpc_no_binder",
match_any = [
":grpc_no_binder_define",
# We do not need binder on ios.
":ios",
],
)
selects.config_setting_group(
name = "grpc_no_rls",
match_any = [
@ -835,6 +855,7 @@ grpc_cc_library(
"//src/core:grpc_lb_policy_weighted_target",
"//src/core:grpc_channel_idle_filter",
"//src/core:grpc_message_size_filter",
"//src/core:grpc_resolver_binder",
"grpc_resolver_dns_ares",
"grpc_resolver_fake",
"//src/core:grpc_resolver_dns_native",
@ -920,6 +941,12 @@ grpc_cc_library(
"grpc++_xds_server",
],
},
{
"grpc_no_binder": [],
"//conditions:default": [
"grpc++_binder",
],
},
],
tags = ["nofixdeps"],
visibility = ["@grpc:public"],
@ -1050,6 +1077,112 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "grpc++_binder",
srcs = [
"//src/core:ext/transport/binder/client/binder_connector.cc",
"//src/core:ext/transport/binder/client/channel_create.cc",
"//src/core:ext/transport/binder/client/channel_create_impl.cc",
"//src/core:ext/transport/binder/client/connection_id_generator.cc",
"//src/core:ext/transport/binder/client/endpoint_binder_pool.cc",
"//src/core:ext/transport/binder/client/jni_utils.cc",
"//src/core:ext/transport/binder/client/security_policy_setting.cc",
"//src/core:ext/transport/binder/security_policy/binder_security_policy.cc",
"//src/core:ext/transport/binder/server/binder_server.cc",
"//src/core:ext/transport/binder/server/binder_server_credentials.cc",
"//src/core:ext/transport/binder/transport/binder_transport.cc",
"//src/core:ext/transport/binder/utils/ndk_binder.cc",
"//src/core:ext/transport/binder/utils/transport_stream_receiver_impl.cc",
"//src/core:ext/transport/binder/wire_format/binder_android.cc",
"//src/core:ext/transport/binder/wire_format/binder_constants.cc",
"//src/core:ext/transport/binder/wire_format/transaction.cc",
"//src/core:ext/transport/binder/wire_format/wire_reader_impl.cc",
"//src/core:ext/transport/binder/wire_format/wire_writer.cc",
],
hdrs = [
"//src/core:ext/transport/binder/client/binder_connector.h",
"//src/core:ext/transport/binder/client/channel_create_impl.h",
"//src/core:ext/transport/binder/client/connection_id_generator.h",
"//src/core:ext/transport/binder/client/endpoint_binder_pool.h",
"//src/core:ext/transport/binder/client/jni_utils.h",
"//src/core:ext/transport/binder/client/security_policy_setting.h",
"//src/core:ext/transport/binder/server/binder_server.h",
"//src/core:ext/transport/binder/transport/binder_stream.h",
"//src/core:ext/transport/binder/transport/binder_transport.h",
"//src/core:ext/transport/binder/utils/binder_auto_utils.h",
"//src/core:ext/transport/binder/utils/ndk_binder.h",
"//src/core:ext/transport/binder/utils/transport_stream_receiver.h",
"//src/core:ext/transport/binder/utils/transport_stream_receiver_impl.h",
"//src/core:ext/transport/binder/wire_format/binder.h",
"//src/core:ext/transport/binder/wire_format/binder_android.h",
"//src/core:ext/transport/binder/wire_format/binder_constants.h",
"//src/core:ext/transport/binder/wire_format/transaction.h",
"//src/core:ext/transport/binder/wire_format/wire_reader.h",
"//src/core:ext/transport/binder/wire_format/wire_reader_impl.h",
"//src/core:ext/transport/binder/wire_format/wire_writer.h",
],
defines = select({
"grpc_no_binder": ["GRPC_NO_BINDER"],
"//conditions:default": [],
}),
external_deps = [
"absl/base:core_headers",
"absl/cleanup",
"absl/container:flat_hash_map",
"absl/functional:any_invocable",
"absl/hash",
"absl/log:check",
"absl/log:log",
"absl/memory",
"absl/meta:type_traits",
"absl/status",
"absl/status:statusor",
"absl/strings",
"absl/synchronization",
"absl/time",
"absl/types:variant",
],
language = "c++",
public_hdrs = [
"include/grpcpp/security/binder_security_policy.h",
"include/grpcpp/create_channel_binder.h",
"include/grpcpp/security/binder_credentials.h",
],
tags = ["nofixdeps"],
deps = [
"channel",
"channel_create",
"config",
"debug_location",
"exec_ctx",
"gpr",
"gpr_platform",
"grpc",
"grpc++_base",
"grpc_base",
"grpc_client_channel",
"grpc_public_hdrs",
"orphanable",
"ref_counted_ptr",
"server",
"//src/core:arena",
"//src/core:channel_args",
"//src/core:channel_args_preconditioning",
"//src/core:channel_stack_type",
"//src/core:default_event_engine",
"//src/core:error_utils",
"//src/core:iomgr_fwd",
"//src/core:iomgr_port",
"//src/core:metadata_batch",
"//src/core:notification",
"//src/core:slice",
"//src/core:slice_refcount",
"//src/core:status_helper",
"//src/core:subchannel_connector",
"//src/core:transport_fwd",
],
)
grpc_cc_library(
name = "grpc++_xds_client",
srcs = [

938
CMakeLists.txt generated

File diff suppressed because it is too large Load Diff

1
Makefile generated

@ -1355,6 +1355,7 @@ LIBGRPC_SRC = \
src/core/load_balancing/xds/xds_wrr_locality.cc \
src/core/plugin_registry/grpc_plugin_registry.cc \
src/core/plugin_registry/grpc_plugin_registry_extra.cc \
src/core/resolver/binder/binder_resolver.cc \
src/core/resolver/dns/c_ares/dns_resolver_ares.cc \
src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc \
src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc \

1
Package.swift generated

@ -1702,6 +1702,7 @@ let package = Package(
"src/core/load_balancing/xds/xds_wrr_locality.cc",
"src/core/plugin_registry/grpc_plugin_registry.cc",
"src/core/plugin_registry/grpc_plugin_registry_extra.cc",
"src/core/resolver/binder/binder_resolver.cc",
"src/core/resolver/dns/c_ares/dns_resolver_ares.cc",
"src/core/resolver/dns/c_ares/dns_resolver_ares.h",
"src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h",

@ -56,6 +56,16 @@ android_ndk_repository(name = "androidndk")
# here, because the toolchain rule fails when $ANDROID_NDK_HOME is not set.
# Use `--extra_toolchains=@androidndk//:all` to manually register it when building for Android.
# Prevents bazel's '...' expansion from including the following folder.
# This is required because the BUILD file in the following folder
# will trigger bazel failure when Android SDK is not configured.
# The targets in the following folder need to be included in APK and will
# be invoked by binder transport implementation through JNI.
local_repository(
name = "binder_transport_android_helper",
path = "src/core/ext/transport/binder/java",
)
# Prevents bazel's '...' expansion from including the following folder.
# This is required to avoid triggering "Unable to find package for @rules_fuzzing//fuzzing:cc_defs.bzl"
# error.

@ -1958,6 +1958,7 @@ libs:
- src/core/load_balancing/xds/xds_wrr_locality.cc
- src/core/plugin_registry/grpc_plugin_registry.cc
- src/core/plugin_registry/grpc_plugin_registry_extra.cc
- src/core/resolver/binder/binder_resolver.cc
- src/core/resolver/dns/c_ares/dns_resolver_ares.cc
- src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
- src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc
@ -3076,6 +3077,7 @@ libs:
- src/core/load_balancing/weighted_target/weighted_target.cc
- src/core/plugin_registry/grpc_plugin_registry.cc
- src/core/plugin_registry/grpc_plugin_registry_noextra.cc
- src/core/resolver/binder/binder_resolver.cc
- src/core/resolver/dns/c_ares/dns_resolver_ares.cc
- src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
- src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc
@ -3761,6 +3763,7 @@ libs:
- include/grpcpp/client_context.h
- include/grpcpp/completion_queue.h
- include/grpcpp/create_channel.h
- include/grpcpp/create_channel_binder.h
- include/grpcpp/create_channel_posix.h
- include/grpcpp/ext/call_metric_recorder.h
- include/grpcpp/ext/health_check_service_server_builder_option.h
@ -3852,6 +3855,8 @@ libs:
- include/grpcpp/security/auth_context.h
- include/grpcpp/security/auth_metadata_processor.h
- include/grpcpp/security/authorization_policy_provider.h
- include/grpcpp/security/binder_credentials.h
- include/grpcpp/security/binder_security_policy.h
- include/grpcpp/security/credentials.h
- include/grpcpp/security/server_credentials.h
- include/grpcpp/security/tls_certificate_provider.h
@ -3890,6 +3895,26 @@ libs:
- include/grpcpp/version_info.h
- include/grpcpp/xds_server_builder.h
headers:
- src/core/ext/transport/binder/client/binder_connector.h
- src/core/ext/transport/binder/client/channel_create_impl.h
- src/core/ext/transport/binder/client/connection_id_generator.h
- src/core/ext/transport/binder/client/endpoint_binder_pool.h
- src/core/ext/transport/binder/client/jni_utils.h
- src/core/ext/transport/binder/client/security_policy_setting.h
- src/core/ext/transport/binder/server/binder_server.h
- src/core/ext/transport/binder/transport/binder_stream.h
- src/core/ext/transport/binder/transport/binder_transport.h
- src/core/ext/transport/binder/utils/binder_auto_utils.h
- src/core/ext/transport/binder/utils/ndk_binder.h
- src/core/ext/transport/binder/utils/transport_stream_receiver.h
- src/core/ext/transport/binder/utils/transport_stream_receiver_impl.h
- src/core/ext/transport/binder/wire_format/binder.h
- src/core/ext/transport/binder/wire_format/binder_android.h
- src/core/ext/transport/binder/wire_format/binder_constants.h
- src/core/ext/transport/binder/wire_format/transaction.h
- src/core/ext/transport/binder/wire_format/wire_reader.h
- src/core/ext/transport/binder/wire_format/wire_reader_impl.h
- src/core/ext/transport/binder/wire_format/wire_writer.h
- src/core/xds/grpc/xds_enabled_server.h
- src/cpp/client/client_stats_interceptor.h
- src/cpp/client/create_channel_internal.h
@ -3903,6 +3928,24 @@ libs:
- src/cpp/server/thread_pool_interface.h
- src/cpp/thread_manager/thread_manager.h
src:
- src/core/ext/transport/binder/client/binder_connector.cc
- src/core/ext/transport/binder/client/channel_create.cc
- src/core/ext/transport/binder/client/channel_create_impl.cc
- src/core/ext/transport/binder/client/connection_id_generator.cc
- src/core/ext/transport/binder/client/endpoint_binder_pool.cc
- src/core/ext/transport/binder/client/jni_utils.cc
- src/core/ext/transport/binder/client/security_policy_setting.cc
- src/core/ext/transport/binder/security_policy/binder_security_policy.cc
- src/core/ext/transport/binder/server/binder_server.cc
- src/core/ext/transport/binder/server/binder_server_credentials.cc
- src/core/ext/transport/binder/transport/binder_transport.cc
- src/core/ext/transport/binder/utils/ndk_binder.cc
- src/core/ext/transport/binder/utils/transport_stream_receiver_impl.cc
- src/core/ext/transport/binder/wire_format/binder_android.cc
- src/core/ext/transport/binder/wire_format/binder_constants.cc
- src/core/ext/transport/binder/wire_format/transaction.cc
- src/core/ext/transport/binder/wire_format/wire_reader_impl.cc
- src/core/ext/transport/binder/wire_format/wire_writer.cc
- src/cpp/client/call_credentials.cc
- src/cpp/client/channel_cc.cc
- src/cpp/client/channel_credentials.cc
@ -6091,6 +6134,146 @@ targets:
- grpc_authorization_provider
- grpc_unsecure
- grpc_test_util
- name: binder_resolver_test
gtest: true
build: test
language: c++
headers: []
src:
- test/core/resolver/binder_resolver_test.cc
deps:
- gtest
- grpc_test_util
- name: binder_server_test
gtest: true
build: test
language: c++
headers:
- test/core/transport/binder/end2end/fake_binder.h
- test/cpp/end2end/test_service_impl.h
src:
- src/proto/grpc/testing/echo.proto
- src/proto/grpc/testing/echo_messages.proto
- src/proto/grpc/testing/simple_messages.proto
- src/proto/grpc/testing/xds/v3/orca_load_report.proto
- test/core/transport/binder/end2end/binder_server_test.cc
- test/core/transport/binder/end2end/fake_binder.cc
- test/cpp/end2end/test_service_impl.cc
deps:
- gtest
- grpc++_test_util
- name: binder_transport_test
gtest: true
build: test
language: c++
headers:
- src/core/ext/transport/binder/client/binder_connector.h
- src/core/ext/transport/binder/client/channel_create_impl.h
- src/core/ext/transport/binder/client/connection_id_generator.h
- src/core/ext/transport/binder/client/endpoint_binder_pool.h
- src/core/ext/transport/binder/client/jni_utils.h
- src/core/ext/transport/binder/client/security_policy_setting.h
- src/core/ext/transport/binder/server/binder_server.h
- src/core/ext/transport/binder/transport/binder_stream.h
- src/core/ext/transport/binder/transport/binder_transport.h
- src/core/ext/transport/binder/utils/binder_auto_utils.h
- src/core/ext/transport/binder/utils/ndk_binder.h
- src/core/ext/transport/binder/utils/transport_stream_receiver.h
- src/core/ext/transport/binder/utils/transport_stream_receiver_impl.h
- src/core/ext/transport/binder/wire_format/binder.h
- src/core/ext/transport/binder/wire_format/binder_android.h
- src/core/ext/transport/binder/wire_format/binder_constants.h
- src/core/ext/transport/binder/wire_format/transaction.h
- src/core/ext/transport/binder/wire_format/wire_reader.h
- src/core/ext/transport/binder/wire_format/wire_reader_impl.h
- src/core/ext/transport/binder/wire_format/wire_writer.h
- src/cpp/client/client_stats_interceptor.h
- src/cpp/client/create_channel_internal.h
- src/cpp/client/secure_credentials.h
- src/cpp/common/secure_auth_context.h
- src/cpp/server/backend_metric_recorder.h
- src/cpp/server/dynamic_thread_pool.h
- src/cpp/server/external_connection_acceptor_impl.h
- src/cpp/server/health/default_health_check_service.h
- src/cpp/server/secure_server_credentials.h
- src/cpp/server/thread_pool_interface.h
- src/cpp/thread_manager/thread_manager.h
- test/core/transport/binder/mock_objects.h
src:
- src/core/ext/transport/binder/client/binder_connector.cc
- src/core/ext/transport/binder/client/channel_create.cc
- src/core/ext/transport/binder/client/channel_create_impl.cc
- src/core/ext/transport/binder/client/connection_id_generator.cc
- src/core/ext/transport/binder/client/endpoint_binder_pool.cc
- src/core/ext/transport/binder/client/jni_utils.cc
- src/core/ext/transport/binder/client/security_policy_setting.cc
- src/core/ext/transport/binder/security_policy/binder_security_policy.cc
- src/core/ext/transport/binder/server/binder_server.cc
- src/core/ext/transport/binder/server/binder_server_credentials.cc
- src/core/ext/transport/binder/transport/binder_transport.cc
- src/core/ext/transport/binder/utils/ndk_binder.cc
- src/core/ext/transport/binder/utils/transport_stream_receiver_impl.cc
- src/core/ext/transport/binder/wire_format/binder_android.cc
- src/core/ext/transport/binder/wire_format/binder_constants.cc
- src/core/ext/transport/binder/wire_format/transaction.cc
- src/core/ext/transport/binder/wire_format/wire_reader_impl.cc
- src/core/ext/transport/binder/wire_format/wire_writer.cc
- src/cpp/client/call_credentials.cc
- src/cpp/client/channel_cc.cc
- src/cpp/client/channel_credentials.cc
- src/cpp/client/client_callback.cc
- src/cpp/client/client_context.cc
- src/cpp/client/client_interceptor.cc
- src/cpp/client/client_stats_interceptor.cc
- src/cpp/client/create_channel.cc
- src/cpp/client/create_channel_internal.cc
- src/cpp/client/create_channel_posix.cc
- src/cpp/client/global_callback_hook.cc
- src/cpp/client/insecure_credentials.cc
- src/cpp/client/secure_credentials.cc
- src/cpp/common/alarm.cc
- src/cpp/common/auth_property_iterator.cc
- src/cpp/common/channel_arguments.cc
- src/cpp/common/completion_queue_cc.cc
- src/cpp/common/resource_quota_cc.cc
- src/cpp/common/rpc_method.cc
- src/cpp/common/secure_auth_context.cc
- src/cpp/common/secure_create_auth_context.cc
- src/cpp/common/tls_certificate_provider.cc
- src/cpp/common/tls_certificate_verifier.cc
- src/cpp/common/tls_credentials_options.cc
- src/cpp/common/validate_service_config.cc
- src/cpp/common/version_cc.cc
- src/cpp/server/async_generic_service.cc
- src/cpp/server/backend_metric_recorder.cc
- src/cpp/server/channel_argument_option.cc
- src/cpp/server/create_default_thread_pool.cc
- src/cpp/server/external_connection_acceptor_impl.cc
- src/cpp/server/health/default_health_check_service.cc
- src/cpp/server/health/health_check_service.cc
- src/cpp/server/health/health_check_service_server_builder_option.cc
- src/cpp/server/insecure_server_credentials.cc
- src/cpp/server/secure_server_credentials.cc
- src/cpp/server/server_builder.cc
- src/cpp/server/server_callback.cc
- src/cpp/server/server_cc.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_credentials.cc
- src/cpp/server/server_posix.cc
- src/cpp/thread_manager/thread_manager.cc
- src/cpp/util/byte_buffer_cc.cc
- src/cpp/util/status.cc
- src/cpp/util/string_ref.cc
- src/cpp/util/time_cc.cc
- test/core/transport/binder/binder_transport_test.cc
- test/core/transport/binder/mock_objects.cc
deps:
- gtest
- absl/log:absl_check
- absl/log:absl_log
- protobuf
- grpc_test_util
uses_polling: false
- name: bitset_test
gtest: true
build: test
@ -9462,6 +9645,30 @@ targets:
- grpc_authorization_provider
- grpc_unsecure
- grpc_test_util
- name: end2end_binder_transport_test
gtest: true
build: test
run: false
language: c++
headers:
- test/core/transport/binder/end2end/fake_binder.h
- test/core/transport/binder/end2end/testing_channel_create.h
- test/cpp/end2end/test_service_impl.h
src:
- src/proto/grpc/testing/echo.proto
- src/proto/grpc/testing/echo_messages.proto
- src/proto/grpc/testing/simple_messages.proto
- src/proto/grpc/testing/xds/v3/orca_load_report.proto
- test/core/transport/binder/end2end/end2end_binder_transport_test.cc
- test/core/transport/binder/end2end/fake_binder.cc
- test/core/transport/binder/end2end/testing_channel_create.cc
- test/cpp/end2end/test_service_impl.cc
deps:
- gtest
- grpc++_test_util
platforms:
- linux
- posix
- name: end2end_test
gtest: true
build: test
@ -9493,6 +9700,118 @@ targets:
- gtest
- grpc_test_util
uses_polling: false
- name: endpoint_binder_pool_test
gtest: true
build: test
language: c++
headers:
- src/core/ext/transport/binder/client/binder_connector.h
- src/core/ext/transport/binder/client/channel_create_impl.h
- src/core/ext/transport/binder/client/connection_id_generator.h
- src/core/ext/transport/binder/client/endpoint_binder_pool.h
- src/core/ext/transport/binder/client/jni_utils.h
- src/core/ext/transport/binder/client/security_policy_setting.h
- src/core/ext/transport/binder/server/binder_server.h
- src/core/ext/transport/binder/transport/binder_stream.h
- src/core/ext/transport/binder/transport/binder_transport.h
- src/core/ext/transport/binder/utils/binder_auto_utils.h
- src/core/ext/transport/binder/utils/ndk_binder.h
- src/core/ext/transport/binder/utils/transport_stream_receiver.h
- src/core/ext/transport/binder/utils/transport_stream_receiver_impl.h
- src/core/ext/transport/binder/wire_format/binder.h
- src/core/ext/transport/binder/wire_format/binder_android.h
- src/core/ext/transport/binder/wire_format/binder_constants.h
- src/core/ext/transport/binder/wire_format/transaction.h
- src/core/ext/transport/binder/wire_format/wire_reader.h
- src/core/ext/transport/binder/wire_format/wire_reader_impl.h
- src/core/ext/transport/binder/wire_format/wire_writer.h
- src/cpp/client/client_stats_interceptor.h
- src/cpp/client/create_channel_internal.h
- src/cpp/client/secure_credentials.h
- src/cpp/common/secure_auth_context.h
- src/cpp/server/backend_metric_recorder.h
- src/cpp/server/dynamic_thread_pool.h
- src/cpp/server/external_connection_acceptor_impl.h
- src/cpp/server/health/default_health_check_service.h
- src/cpp/server/secure_server_credentials.h
- src/cpp/server/thread_pool_interface.h
- src/cpp/thread_manager/thread_manager.h
- test/core/transport/binder/mock_objects.h
src:
- src/core/ext/transport/binder/client/binder_connector.cc
- src/core/ext/transport/binder/client/channel_create.cc
- src/core/ext/transport/binder/client/channel_create_impl.cc
- src/core/ext/transport/binder/client/connection_id_generator.cc
- src/core/ext/transport/binder/client/endpoint_binder_pool.cc
- src/core/ext/transport/binder/client/jni_utils.cc
- src/core/ext/transport/binder/client/security_policy_setting.cc
- src/core/ext/transport/binder/security_policy/binder_security_policy.cc
- src/core/ext/transport/binder/server/binder_server.cc
- src/core/ext/transport/binder/server/binder_server_credentials.cc
- src/core/ext/transport/binder/transport/binder_transport.cc
- src/core/ext/transport/binder/utils/ndk_binder.cc
- src/core/ext/transport/binder/utils/transport_stream_receiver_impl.cc
- src/core/ext/transport/binder/wire_format/binder_android.cc
- src/core/ext/transport/binder/wire_format/binder_constants.cc
- src/core/ext/transport/binder/wire_format/transaction.cc
- src/core/ext/transport/binder/wire_format/wire_reader_impl.cc
- src/core/ext/transport/binder/wire_format/wire_writer.cc
- src/cpp/client/call_credentials.cc
- src/cpp/client/channel_cc.cc
- src/cpp/client/channel_credentials.cc
- src/cpp/client/client_callback.cc
- src/cpp/client/client_context.cc
- src/cpp/client/client_interceptor.cc
- src/cpp/client/client_stats_interceptor.cc
- src/cpp/client/create_channel.cc
- src/cpp/client/create_channel_internal.cc
- src/cpp/client/create_channel_posix.cc
- src/cpp/client/global_callback_hook.cc
- src/cpp/client/insecure_credentials.cc
- src/cpp/client/secure_credentials.cc
- src/cpp/common/alarm.cc
- src/cpp/common/auth_property_iterator.cc
- src/cpp/common/channel_arguments.cc
- src/cpp/common/completion_queue_cc.cc
- src/cpp/common/resource_quota_cc.cc
- src/cpp/common/rpc_method.cc
- src/cpp/common/secure_auth_context.cc
- src/cpp/common/secure_create_auth_context.cc
- src/cpp/common/tls_certificate_provider.cc
- src/cpp/common/tls_certificate_verifier.cc
- src/cpp/common/tls_credentials_options.cc
- src/cpp/common/validate_service_config.cc
- src/cpp/common/version_cc.cc
- src/cpp/server/async_generic_service.cc
- src/cpp/server/backend_metric_recorder.cc
- src/cpp/server/channel_argument_option.cc
- src/cpp/server/create_default_thread_pool.cc
- src/cpp/server/external_connection_acceptor_impl.cc
- src/cpp/server/health/default_health_check_service.cc
- src/cpp/server/health/health_check_service.cc
- src/cpp/server/health/health_check_service_server_builder_option.cc
- src/cpp/server/insecure_server_credentials.cc
- src/cpp/server/secure_server_credentials.cc
- src/cpp/server/server_builder.cc
- src/cpp/server/server_callback.cc
- src/cpp/server/server_cc.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_credentials.cc
- src/cpp/server/server_posix.cc
- src/cpp/thread_manager/thread_manager.cc
- src/cpp/util/byte_buffer_cc.cc
- src/cpp/util/status.cc
- src/cpp/util/string_ref.cc
- src/cpp/util/time_cc.cc
- test/core/transport/binder/endpoint_binder_pool_test.cc
- test/core/transport/binder/mock_objects.cc
deps:
- gtest
- absl/log:absl_check
- absl/log:absl_log
- protobuf
- grpc_test_util
uses_polling: false
- name: endpoint_config_test
gtest: true
build: test
@ -9857,6 +10176,118 @@ targets:
deps:
- gtest
- grpc_test_util_unsecure
- name: fake_binder_test
gtest: true
build: test
language: c++
headers:
- src/core/ext/transport/binder/client/binder_connector.h
- src/core/ext/transport/binder/client/channel_create_impl.h
- src/core/ext/transport/binder/client/connection_id_generator.h
- src/core/ext/transport/binder/client/endpoint_binder_pool.h
- src/core/ext/transport/binder/client/jni_utils.h
- src/core/ext/transport/binder/client/security_policy_setting.h
- src/core/ext/transport/binder/server/binder_server.h
- src/core/ext/transport/binder/transport/binder_stream.h
- src/core/ext/transport/binder/transport/binder_transport.h
- src/core/ext/transport/binder/utils/binder_auto_utils.h
- src/core/ext/transport/binder/utils/ndk_binder.h
- src/core/ext/transport/binder/utils/transport_stream_receiver.h
- src/core/ext/transport/binder/utils/transport_stream_receiver_impl.h
- src/core/ext/transport/binder/wire_format/binder.h
- src/core/ext/transport/binder/wire_format/binder_android.h
- src/core/ext/transport/binder/wire_format/binder_constants.h
- src/core/ext/transport/binder/wire_format/transaction.h
- src/core/ext/transport/binder/wire_format/wire_reader.h
- src/core/ext/transport/binder/wire_format/wire_reader_impl.h
- src/core/ext/transport/binder/wire_format/wire_writer.h
- src/cpp/client/client_stats_interceptor.h
- src/cpp/client/create_channel_internal.h
- src/cpp/client/secure_credentials.h
- src/cpp/common/secure_auth_context.h
- src/cpp/server/backend_metric_recorder.h
- src/cpp/server/dynamic_thread_pool.h
- src/cpp/server/external_connection_acceptor_impl.h
- src/cpp/server/health/default_health_check_service.h
- src/cpp/server/secure_server_credentials.h
- src/cpp/server/thread_pool_interface.h
- src/cpp/thread_manager/thread_manager.h
- test/core/transport/binder/end2end/fake_binder.h
src:
- src/core/ext/transport/binder/client/binder_connector.cc
- src/core/ext/transport/binder/client/channel_create.cc
- src/core/ext/transport/binder/client/channel_create_impl.cc
- src/core/ext/transport/binder/client/connection_id_generator.cc
- src/core/ext/transport/binder/client/endpoint_binder_pool.cc
- src/core/ext/transport/binder/client/jni_utils.cc
- src/core/ext/transport/binder/client/security_policy_setting.cc
- src/core/ext/transport/binder/security_policy/binder_security_policy.cc
- src/core/ext/transport/binder/server/binder_server.cc
- src/core/ext/transport/binder/server/binder_server_credentials.cc
- src/core/ext/transport/binder/transport/binder_transport.cc
- src/core/ext/transport/binder/utils/ndk_binder.cc
- src/core/ext/transport/binder/utils/transport_stream_receiver_impl.cc
- src/core/ext/transport/binder/wire_format/binder_android.cc
- src/core/ext/transport/binder/wire_format/binder_constants.cc
- src/core/ext/transport/binder/wire_format/transaction.cc
- src/core/ext/transport/binder/wire_format/wire_reader_impl.cc
- src/core/ext/transport/binder/wire_format/wire_writer.cc
- src/cpp/client/call_credentials.cc
- src/cpp/client/channel_cc.cc
- src/cpp/client/channel_credentials.cc
- src/cpp/client/client_callback.cc
- src/cpp/client/client_context.cc
- src/cpp/client/client_interceptor.cc
- src/cpp/client/client_stats_interceptor.cc
- src/cpp/client/create_channel.cc
- src/cpp/client/create_channel_internal.cc
- src/cpp/client/create_channel_posix.cc
- src/cpp/client/global_callback_hook.cc
- src/cpp/client/insecure_credentials.cc
- src/cpp/client/secure_credentials.cc
- src/cpp/common/alarm.cc
- src/cpp/common/auth_property_iterator.cc
- src/cpp/common/channel_arguments.cc
- src/cpp/common/completion_queue_cc.cc
- src/cpp/common/resource_quota_cc.cc
- src/cpp/common/rpc_method.cc
- src/cpp/common/secure_auth_context.cc
- src/cpp/common/secure_create_auth_context.cc
- src/cpp/common/tls_certificate_provider.cc
- src/cpp/common/tls_certificate_verifier.cc
- src/cpp/common/tls_credentials_options.cc
- src/cpp/common/validate_service_config.cc
- src/cpp/common/version_cc.cc
- src/cpp/server/async_generic_service.cc
- src/cpp/server/backend_metric_recorder.cc
- src/cpp/server/channel_argument_option.cc
- src/cpp/server/create_default_thread_pool.cc
- src/cpp/server/external_connection_acceptor_impl.cc
- src/cpp/server/health/default_health_check_service.cc
- src/cpp/server/health/health_check_service.cc
- src/cpp/server/health/health_check_service_server_builder_option.cc
- src/cpp/server/insecure_server_credentials.cc
- src/cpp/server/secure_server_credentials.cc
- src/cpp/server/server_builder.cc
- src/cpp/server/server_callback.cc
- src/cpp/server/server_cc.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_credentials.cc
- src/cpp/server/server_posix.cc
- src/cpp/thread_manager/thread_manager.cc
- src/cpp/util/byte_buffer_cc.cc
- src/cpp/util/status.cc
- src/cpp/util/string_ref.cc
- src/cpp/util/time_cc.cc
- test/core/transport/binder/end2end/fake_binder.cc
- test/core/transport/binder/end2end/fake_binder_test.cc
deps:
- gtest
- absl/log:absl_check
- absl/log:absl_log
- protobuf
- grpc_test_util
uses_polling: false
- name: fake_resolver_test
gtest: true
build: test
@ -20218,6 +20649,116 @@ targets:
deps:
- gtest
- grpc_test_util
- name: transport_stream_receiver_test
gtest: true
build: test
language: c++
headers:
- src/core/ext/transport/binder/client/binder_connector.h
- src/core/ext/transport/binder/client/channel_create_impl.h
- src/core/ext/transport/binder/client/connection_id_generator.h
- src/core/ext/transport/binder/client/endpoint_binder_pool.h
- src/core/ext/transport/binder/client/jni_utils.h
- src/core/ext/transport/binder/client/security_policy_setting.h
- src/core/ext/transport/binder/server/binder_server.h
- src/core/ext/transport/binder/transport/binder_stream.h
- src/core/ext/transport/binder/transport/binder_transport.h
- src/core/ext/transport/binder/utils/binder_auto_utils.h
- src/core/ext/transport/binder/utils/ndk_binder.h
- src/core/ext/transport/binder/utils/transport_stream_receiver.h
- src/core/ext/transport/binder/utils/transport_stream_receiver_impl.h
- src/core/ext/transport/binder/wire_format/binder.h
- src/core/ext/transport/binder/wire_format/binder_android.h
- src/core/ext/transport/binder/wire_format/binder_constants.h
- src/core/ext/transport/binder/wire_format/transaction.h
- src/core/ext/transport/binder/wire_format/wire_reader.h
- src/core/ext/transport/binder/wire_format/wire_reader_impl.h
- src/core/ext/transport/binder/wire_format/wire_writer.h
- src/cpp/client/client_stats_interceptor.h
- src/cpp/client/create_channel_internal.h
- src/cpp/client/secure_credentials.h
- src/cpp/common/secure_auth_context.h
- src/cpp/server/backend_metric_recorder.h
- src/cpp/server/dynamic_thread_pool.h
- src/cpp/server/external_connection_acceptor_impl.h
- src/cpp/server/health/default_health_check_service.h
- src/cpp/server/secure_server_credentials.h
- src/cpp/server/thread_pool_interface.h
- src/cpp/thread_manager/thread_manager.h
src:
- src/core/ext/transport/binder/client/binder_connector.cc
- src/core/ext/transport/binder/client/channel_create.cc
- src/core/ext/transport/binder/client/channel_create_impl.cc
- src/core/ext/transport/binder/client/connection_id_generator.cc
- src/core/ext/transport/binder/client/endpoint_binder_pool.cc
- src/core/ext/transport/binder/client/jni_utils.cc
- src/core/ext/transport/binder/client/security_policy_setting.cc
- src/core/ext/transport/binder/security_policy/binder_security_policy.cc
- src/core/ext/transport/binder/server/binder_server.cc
- src/core/ext/transport/binder/server/binder_server_credentials.cc
- src/core/ext/transport/binder/transport/binder_transport.cc
- src/core/ext/transport/binder/utils/ndk_binder.cc
- src/core/ext/transport/binder/utils/transport_stream_receiver_impl.cc
- src/core/ext/transport/binder/wire_format/binder_android.cc
- src/core/ext/transport/binder/wire_format/binder_constants.cc
- src/core/ext/transport/binder/wire_format/transaction.cc
- src/core/ext/transport/binder/wire_format/wire_reader_impl.cc
- src/core/ext/transport/binder/wire_format/wire_writer.cc
- src/cpp/client/call_credentials.cc
- src/cpp/client/channel_cc.cc
- src/cpp/client/channel_credentials.cc
- src/cpp/client/client_callback.cc
- src/cpp/client/client_context.cc
- src/cpp/client/client_interceptor.cc
- src/cpp/client/client_stats_interceptor.cc
- src/cpp/client/create_channel.cc
- src/cpp/client/create_channel_internal.cc
- src/cpp/client/create_channel_posix.cc
- src/cpp/client/global_callback_hook.cc
- src/cpp/client/insecure_credentials.cc
- src/cpp/client/secure_credentials.cc
- src/cpp/common/alarm.cc
- src/cpp/common/auth_property_iterator.cc
- src/cpp/common/channel_arguments.cc
- src/cpp/common/completion_queue_cc.cc
- src/cpp/common/resource_quota_cc.cc
- src/cpp/common/rpc_method.cc
- src/cpp/common/secure_auth_context.cc
- src/cpp/common/secure_create_auth_context.cc
- src/cpp/common/tls_certificate_provider.cc
- src/cpp/common/tls_certificate_verifier.cc
- src/cpp/common/tls_credentials_options.cc
- src/cpp/common/validate_service_config.cc
- src/cpp/common/version_cc.cc
- src/cpp/server/async_generic_service.cc
- src/cpp/server/backend_metric_recorder.cc
- src/cpp/server/channel_argument_option.cc
- src/cpp/server/create_default_thread_pool.cc
- src/cpp/server/external_connection_acceptor_impl.cc
- src/cpp/server/health/default_health_check_service.cc
- src/cpp/server/health/health_check_service.cc
- src/cpp/server/health/health_check_service_server_builder_option.cc
- src/cpp/server/insecure_server_credentials.cc
- src/cpp/server/secure_server_credentials.cc
- src/cpp/server/server_builder.cc
- src/cpp/server/server_callback.cc
- src/cpp/server/server_cc.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_credentials.cc
- src/cpp/server/server_posix.cc
- src/cpp/thread_manager/thread_manager.cc
- src/cpp/util/byte_buffer_cc.cc
- src/cpp/util/status.cc
- src/cpp/util/string_ref.cc
- src/cpp/util/time_cc.cc
- test/core/transport/binder/transport_stream_receiver_test.cc
deps:
- gtest
- absl/log:absl_check
- absl/log:absl_log
- protobuf
- grpc_test_util
uses_polling: false
- name: try_join_test
gtest: true
build: test
@ -20527,6 +21068,230 @@ targets:
- posix
- windows
uses_polling: false
- name: wire_reader_test
gtest: true
build: test
language: c++
headers:
- src/core/ext/transport/binder/client/binder_connector.h
- src/core/ext/transport/binder/client/channel_create_impl.h
- src/core/ext/transport/binder/client/connection_id_generator.h
- src/core/ext/transport/binder/client/endpoint_binder_pool.h
- src/core/ext/transport/binder/client/jni_utils.h
- src/core/ext/transport/binder/client/security_policy_setting.h
- src/core/ext/transport/binder/server/binder_server.h
- src/core/ext/transport/binder/transport/binder_stream.h
- src/core/ext/transport/binder/transport/binder_transport.h
- src/core/ext/transport/binder/utils/binder_auto_utils.h
- src/core/ext/transport/binder/utils/ndk_binder.h
- src/core/ext/transport/binder/utils/transport_stream_receiver.h
- src/core/ext/transport/binder/utils/transport_stream_receiver_impl.h
- src/core/ext/transport/binder/wire_format/binder.h
- src/core/ext/transport/binder/wire_format/binder_android.h
- src/core/ext/transport/binder/wire_format/binder_constants.h
- src/core/ext/transport/binder/wire_format/transaction.h
- src/core/ext/transport/binder/wire_format/wire_reader.h
- src/core/ext/transport/binder/wire_format/wire_reader_impl.h
- src/core/ext/transport/binder/wire_format/wire_writer.h
- src/cpp/client/client_stats_interceptor.h
- src/cpp/client/create_channel_internal.h
- src/cpp/client/secure_credentials.h
- src/cpp/common/secure_auth_context.h
- src/cpp/server/backend_metric_recorder.h
- src/cpp/server/dynamic_thread_pool.h
- src/cpp/server/external_connection_acceptor_impl.h
- src/cpp/server/health/default_health_check_service.h
- src/cpp/server/secure_server_credentials.h
- src/cpp/server/thread_pool_interface.h
- src/cpp/thread_manager/thread_manager.h
- test/core/transport/binder/mock_objects.h
src:
- src/core/ext/transport/binder/client/binder_connector.cc
- src/core/ext/transport/binder/client/channel_create.cc
- src/core/ext/transport/binder/client/channel_create_impl.cc
- src/core/ext/transport/binder/client/connection_id_generator.cc
- src/core/ext/transport/binder/client/endpoint_binder_pool.cc
- src/core/ext/transport/binder/client/jni_utils.cc
- src/core/ext/transport/binder/client/security_policy_setting.cc
- src/core/ext/transport/binder/security_policy/binder_security_policy.cc
- src/core/ext/transport/binder/server/binder_server.cc
- src/core/ext/transport/binder/server/binder_server_credentials.cc
- src/core/ext/transport/binder/transport/binder_transport.cc
- src/core/ext/transport/binder/utils/ndk_binder.cc
- src/core/ext/transport/binder/utils/transport_stream_receiver_impl.cc
- src/core/ext/transport/binder/wire_format/binder_android.cc
- src/core/ext/transport/binder/wire_format/binder_constants.cc
- src/core/ext/transport/binder/wire_format/transaction.cc
- src/core/ext/transport/binder/wire_format/wire_reader_impl.cc
- src/core/ext/transport/binder/wire_format/wire_writer.cc
- src/cpp/client/call_credentials.cc
- src/cpp/client/channel_cc.cc
- src/cpp/client/channel_credentials.cc
- src/cpp/client/client_callback.cc
- src/cpp/client/client_context.cc
- src/cpp/client/client_interceptor.cc
- src/cpp/client/client_stats_interceptor.cc
- src/cpp/client/create_channel.cc
- src/cpp/client/create_channel_internal.cc
- src/cpp/client/create_channel_posix.cc
- src/cpp/client/global_callback_hook.cc
- src/cpp/client/insecure_credentials.cc
- src/cpp/client/secure_credentials.cc
- src/cpp/common/alarm.cc
- src/cpp/common/auth_property_iterator.cc
- src/cpp/common/channel_arguments.cc
- src/cpp/common/completion_queue_cc.cc
- src/cpp/common/resource_quota_cc.cc
- src/cpp/common/rpc_method.cc
- src/cpp/common/secure_auth_context.cc
- src/cpp/common/secure_create_auth_context.cc
- src/cpp/common/tls_certificate_provider.cc
- src/cpp/common/tls_certificate_verifier.cc
- src/cpp/common/tls_credentials_options.cc
- src/cpp/common/validate_service_config.cc
- src/cpp/common/version_cc.cc
- src/cpp/server/async_generic_service.cc
- src/cpp/server/backend_metric_recorder.cc
- src/cpp/server/channel_argument_option.cc
- src/cpp/server/create_default_thread_pool.cc
- src/cpp/server/external_connection_acceptor_impl.cc
- src/cpp/server/health/default_health_check_service.cc
- src/cpp/server/health/health_check_service.cc
- src/cpp/server/health/health_check_service_server_builder_option.cc
- src/cpp/server/insecure_server_credentials.cc
- src/cpp/server/secure_server_credentials.cc
- src/cpp/server/server_builder.cc
- src/cpp/server/server_callback.cc
- src/cpp/server/server_cc.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_credentials.cc
- src/cpp/server/server_posix.cc
- src/cpp/thread_manager/thread_manager.cc
- src/cpp/util/byte_buffer_cc.cc
- src/cpp/util/status.cc
- src/cpp/util/string_ref.cc
- src/cpp/util/time_cc.cc
- test/core/transport/binder/mock_objects.cc
- test/core/transport/binder/wire_reader_test.cc
deps:
- gtest
- absl/log:absl_check
- absl/log:absl_log
- protobuf
- grpc_test_util
uses_polling: false
- name: wire_writer_test
gtest: true
build: test
language: c++
headers:
- src/core/ext/transport/binder/client/binder_connector.h
- src/core/ext/transport/binder/client/channel_create_impl.h
- src/core/ext/transport/binder/client/connection_id_generator.h
- src/core/ext/transport/binder/client/endpoint_binder_pool.h
- src/core/ext/transport/binder/client/jni_utils.h
- src/core/ext/transport/binder/client/security_policy_setting.h
- src/core/ext/transport/binder/server/binder_server.h
- src/core/ext/transport/binder/transport/binder_stream.h
- src/core/ext/transport/binder/transport/binder_transport.h
- src/core/ext/transport/binder/utils/binder_auto_utils.h
- src/core/ext/transport/binder/utils/ndk_binder.h
- src/core/ext/transport/binder/utils/transport_stream_receiver.h
- src/core/ext/transport/binder/utils/transport_stream_receiver_impl.h
- src/core/ext/transport/binder/wire_format/binder.h
- src/core/ext/transport/binder/wire_format/binder_android.h
- src/core/ext/transport/binder/wire_format/binder_constants.h
- src/core/ext/transport/binder/wire_format/transaction.h
- src/core/ext/transport/binder/wire_format/wire_reader.h
- src/core/ext/transport/binder/wire_format/wire_reader_impl.h
- src/core/ext/transport/binder/wire_format/wire_writer.h
- src/cpp/client/client_stats_interceptor.h
- src/cpp/client/create_channel_internal.h
- src/cpp/client/secure_credentials.h
- src/cpp/common/secure_auth_context.h
- src/cpp/server/backend_metric_recorder.h
- src/cpp/server/dynamic_thread_pool.h
- src/cpp/server/external_connection_acceptor_impl.h
- src/cpp/server/health/default_health_check_service.h
- src/cpp/server/secure_server_credentials.h
- src/cpp/server/thread_pool_interface.h
- src/cpp/thread_manager/thread_manager.h
- test/core/transport/binder/mock_objects.h
src:
- src/core/ext/transport/binder/client/binder_connector.cc
- src/core/ext/transport/binder/client/channel_create.cc
- src/core/ext/transport/binder/client/channel_create_impl.cc
- src/core/ext/transport/binder/client/connection_id_generator.cc
- src/core/ext/transport/binder/client/endpoint_binder_pool.cc
- src/core/ext/transport/binder/client/jni_utils.cc
- src/core/ext/transport/binder/client/security_policy_setting.cc
- src/core/ext/transport/binder/security_policy/binder_security_policy.cc
- src/core/ext/transport/binder/server/binder_server.cc
- src/core/ext/transport/binder/server/binder_server_credentials.cc
- src/core/ext/transport/binder/transport/binder_transport.cc
- src/core/ext/transport/binder/utils/ndk_binder.cc
- src/core/ext/transport/binder/utils/transport_stream_receiver_impl.cc
- src/core/ext/transport/binder/wire_format/binder_android.cc
- src/core/ext/transport/binder/wire_format/binder_constants.cc
- src/core/ext/transport/binder/wire_format/transaction.cc
- src/core/ext/transport/binder/wire_format/wire_reader_impl.cc
- src/core/ext/transport/binder/wire_format/wire_writer.cc
- src/cpp/client/call_credentials.cc
- src/cpp/client/channel_cc.cc
- src/cpp/client/channel_credentials.cc
- src/cpp/client/client_callback.cc
- src/cpp/client/client_context.cc
- src/cpp/client/client_interceptor.cc
- src/cpp/client/client_stats_interceptor.cc
- src/cpp/client/create_channel.cc
- src/cpp/client/create_channel_internal.cc
- src/cpp/client/create_channel_posix.cc
- src/cpp/client/global_callback_hook.cc
- src/cpp/client/insecure_credentials.cc
- src/cpp/client/secure_credentials.cc
- src/cpp/common/alarm.cc
- src/cpp/common/auth_property_iterator.cc
- src/cpp/common/channel_arguments.cc
- src/cpp/common/completion_queue_cc.cc
- src/cpp/common/resource_quota_cc.cc
- src/cpp/common/rpc_method.cc
- src/cpp/common/secure_auth_context.cc
- src/cpp/common/secure_create_auth_context.cc
- src/cpp/common/tls_certificate_provider.cc
- src/cpp/common/tls_certificate_verifier.cc
- src/cpp/common/tls_credentials_options.cc
- src/cpp/common/validate_service_config.cc
- src/cpp/common/version_cc.cc
- src/cpp/server/async_generic_service.cc
- src/cpp/server/backend_metric_recorder.cc
- src/cpp/server/channel_argument_option.cc
- src/cpp/server/create_default_thread_pool.cc
- src/cpp/server/external_connection_acceptor_impl.cc
- src/cpp/server/health/default_health_check_service.cc
- src/cpp/server/health/health_check_service.cc
- src/cpp/server/health/health_check_service_server_builder_option.cc
- src/cpp/server/insecure_server_credentials.cc
- src/cpp/server/secure_server_credentials.cc
- src/cpp/server/server_builder.cc
- src/cpp/server/server_callback.cc
- src/cpp/server/server_cc.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_credentials.cc
- src/cpp/server/server_posix.cc
- src/cpp/thread_manager/thread_manager.cc
- src/cpp/util/byte_buffer_cc.cc
- src/cpp/util/status.cc
- src/cpp/util/string_ref.cc
- src/cpp/util/time_cc.cc
- test/core/transport/binder/mock_objects.cc
- test/core/transport/binder/wire_writer_test.cc
deps:
- gtest
- absl/log:absl_check
- absl/log:absl_log
- protobuf
- grpc_test_util
uses_polling: false
- name: work_serializer_test
gtest: true
build: test

2
config.m4 generated

@ -730,6 +730,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/load_balancing/xds/xds_wrr_locality.cc \
src/core/plugin_registry/grpc_plugin_registry.cc \
src/core/plugin_registry/grpc_plugin_registry_extra.cc \
src/core/resolver/binder/binder_resolver.cc \
src/core/resolver/dns/c_ares/dns_resolver_ares.cc \
src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc \
src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc \
@ -1600,6 +1601,7 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/load_balancing/xds)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/plugin_registry)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/resolver)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/resolver/binder)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/resolver/dns)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/resolver/dns/c_ares)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/resolver/dns/event_engine)

2
config.w32 generated

@ -695,6 +695,7 @@ if (PHP_GRPC != "no") {
"src\\core\\load_balancing\\xds\\xds_wrr_locality.cc " +
"src\\core\\plugin_registry\\grpc_plugin_registry.cc " +
"src\\core\\plugin_registry\\grpc_plugin_registry_extra.cc " +
"src\\core\\resolver\\binder\\binder_resolver.cc " +
"src\\core\\resolver\\dns\\c_ares\\dns_resolver_ares.cc " +
"src\\core\\resolver\\dns\\c_ares\\grpc_ares_ev_driver_posix.cc " +
"src\\core\\resolver\\dns\\c_ares\\grpc_ares_ev_driver_windows.cc " +
@ -1740,6 +1741,7 @@ if (PHP_GRPC != "no") {
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\load_balancing\\xds");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\plugin_registry");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\resolver");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\resolver\\binder");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\resolver\\dns");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\resolver\\dns\\c_ares");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\resolver\\dns\\event_engine");

61
gRPC-C++.podspec generated

@ -97,6 +97,7 @@ Pod::Spec.new do |s|
'include/grpcpp/client_context.h',
'include/grpcpp/completion_queue.h',
'include/grpcpp/create_channel.h',
'include/grpcpp/create_channel_binder.h',
'include/grpcpp/create_channel_posix.h',
'include/grpcpp/ext/call_metric_recorder.h',
'include/grpcpp/ext/health_check_service_server_builder_option.h',
@ -184,6 +185,8 @@ Pod::Spec.new do |s|
'include/grpcpp/security/auth_context.h',
'include/grpcpp/security/auth_metadata_processor.h',
'include/grpcpp/security/authorization_policy_provider.h',
'include/grpcpp/security/binder_credentials.h',
'include/grpcpp/security/binder_security_policy.h',
'include/grpcpp/security/credentials.h',
'include/grpcpp/security/server_credentials.h',
'include/grpcpp/security/tls_certificate_provider.h',
@ -310,6 +313,44 @@ Pod::Spec.new do |s|
'src/core/ext/filters/rbac/rbac_service_config_parser.h',
'src/core/ext/filters/stateful_session/stateful_session_filter.h',
'src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h',
'src/core/ext/transport/binder/client/binder_connector.cc',
'src/core/ext/transport/binder/client/binder_connector.h',
'src/core/ext/transport/binder/client/channel_create.cc',
'src/core/ext/transport/binder/client/channel_create_impl.cc',
'src/core/ext/transport/binder/client/channel_create_impl.h',
'src/core/ext/transport/binder/client/connection_id_generator.cc',
'src/core/ext/transport/binder/client/connection_id_generator.h',
'src/core/ext/transport/binder/client/endpoint_binder_pool.cc',
'src/core/ext/transport/binder/client/endpoint_binder_pool.h',
'src/core/ext/transport/binder/client/jni_utils.cc',
'src/core/ext/transport/binder/client/jni_utils.h',
'src/core/ext/transport/binder/client/security_policy_setting.cc',
'src/core/ext/transport/binder/client/security_policy_setting.h',
'src/core/ext/transport/binder/security_policy/binder_security_policy.cc',
'src/core/ext/transport/binder/server/binder_server.cc',
'src/core/ext/transport/binder/server/binder_server.h',
'src/core/ext/transport/binder/server/binder_server_credentials.cc',
'src/core/ext/transport/binder/transport/binder_stream.h',
'src/core/ext/transport/binder/transport/binder_transport.cc',
'src/core/ext/transport/binder/transport/binder_transport.h',
'src/core/ext/transport/binder/utils/binder_auto_utils.h',
'src/core/ext/transport/binder/utils/ndk_binder.cc',
'src/core/ext/transport/binder/utils/ndk_binder.h',
'src/core/ext/transport/binder/utils/transport_stream_receiver.h',
'src/core/ext/transport/binder/utils/transport_stream_receiver_impl.cc',
'src/core/ext/transport/binder/utils/transport_stream_receiver_impl.h',
'src/core/ext/transport/binder/wire_format/binder.h',
'src/core/ext/transport/binder/wire_format/binder_android.cc',
'src/core/ext/transport/binder/wire_format/binder_android.h',
'src/core/ext/transport/binder/wire_format/binder_constants.cc',
'src/core/ext/transport/binder/wire_format/binder_constants.h',
'src/core/ext/transport/binder/wire_format/transaction.cc',
'src/core/ext/transport/binder/wire_format/transaction.h',
'src/core/ext/transport/binder/wire_format/wire_reader.h',
'src/core/ext/transport/binder/wire_format/wire_reader_impl.cc',
'src/core/ext/transport/binder/wire_format/wire_reader_impl.h',
'src/core/ext/transport/binder/wire_format/wire_writer.cc',
'src/core/ext/transport/binder/wire_format/wire_writer.h',
'src/core/ext/transport/chttp2/alpn/alpn.h',
'src/core/ext/transport/chttp2/client/chttp2_connector.h',
'src/core/ext/transport/chttp2/server/chttp2_server.h',
@ -1595,6 +1636,26 @@ Pod::Spec.new do |s|
'src/core/ext/filters/rbac/rbac_service_config_parser.h',
'src/core/ext/filters/stateful_session/stateful_session_filter.h',
'src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h',
'src/core/ext/transport/binder/client/binder_connector.h',
'src/core/ext/transport/binder/client/channel_create_impl.h',
'src/core/ext/transport/binder/client/connection_id_generator.h',
'src/core/ext/transport/binder/client/endpoint_binder_pool.h',
'src/core/ext/transport/binder/client/jni_utils.h',
'src/core/ext/transport/binder/client/security_policy_setting.h',
'src/core/ext/transport/binder/server/binder_server.h',
'src/core/ext/transport/binder/transport/binder_stream.h',
'src/core/ext/transport/binder/transport/binder_transport.h',
'src/core/ext/transport/binder/utils/binder_auto_utils.h',
'src/core/ext/transport/binder/utils/ndk_binder.h',
'src/core/ext/transport/binder/utils/transport_stream_receiver.h',
'src/core/ext/transport/binder/utils/transport_stream_receiver_impl.h',
'src/core/ext/transport/binder/wire_format/binder.h',
'src/core/ext/transport/binder/wire_format/binder_android.h',
'src/core/ext/transport/binder/wire_format/binder_constants.h',
'src/core/ext/transport/binder/wire_format/transaction.h',
'src/core/ext/transport/binder/wire_format/wire_reader.h',
'src/core/ext/transport/binder/wire_format/wire_reader_impl.h',
'src/core/ext/transport/binder/wire_format/wire_writer.h',
'src/core/ext/transport/chttp2/alpn/alpn.h',
'src/core/ext/transport/chttp2/client/chttp2_connector.h',
'src/core/ext/transport/chttp2/server/chttp2_server.h',

1
gRPC-Core.podspec generated

@ -1818,6 +1818,7 @@ Pod::Spec.new do |s|
'src/core/load_balancing/xds/xds_wrr_locality.cc',
'src/core/plugin_registry/grpc_plugin_registry.cc',
'src/core/plugin_registry/grpc_plugin_registry_extra.cc',
'src/core/resolver/binder/binder_resolver.cc',
'src/core/resolver/dns/c_ares/dns_resolver_ares.cc',
'src/core/resolver/dns/c_ares/dns_resolver_ares.h',
'src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h',

1
grpc.gemspec generated

@ -1704,6 +1704,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/load_balancing/xds/xds_wrr_locality.cc )
s.files += %w( src/core/plugin_registry/grpc_plugin_registry.cc )
s.files += %w( src/core/plugin_registry/grpc_plugin_registry_extra.cc )
s.files += %w( src/core/resolver/binder/binder_resolver.cc )
s.files += %w( src/core/resolver/dns/c_ares/dns_resolver_ares.cc )
s.files += %w( src/core/resolver/dns/c_ares/dns_resolver_ares.h )
s.files += %w( src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h )

@ -172,6 +172,7 @@
#if __ANDROID_API__ < 21
#error "Requires Android API v21 and above"
#endif
#define GPR_SUPPORT_BINDER_TRANSPORT 1
// TODO(apolcyn): re-evaluate support for c-ares
// on android after upgrading our c-ares dependency.
// See https://github.com/grpc/grpc/issues/18038.

@ -0,0 +1,82 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPCPP_SECURITY_BINDER_SECURITY_POLICY_H
#define GRPCPP_SECURITY_BINDER_SECURITY_POLICY_H
#include <memory>
#ifdef GPR_ANDROID
#include <jni.h>
#endif
namespace grpc {
namespace experimental {
namespace binder {
// EXPERIMENTAL Determinines if a connection is allowed to be
// established on Android. See https://source.android.com/security/app-sandbox
// for more info about UID.
class SecurityPolicy {
public:
virtual ~SecurityPolicy() = default;
// Returns true if the UID is authorized to connect.
// Must return the same value for the same inputs so callers can safely cache
// the result.
virtual bool IsAuthorized(int uid) = 0;
};
// EXPERIMENTAL Allows all connection. Anything on the Android device will be
// able to connect, use with caution!
class UntrustedSecurityPolicy : public SecurityPolicy {
public:
UntrustedSecurityPolicy();
~UntrustedSecurityPolicy() override;
bool IsAuthorized(int uid) override;
};
// EXPERIMENTAL Only allows the connections from processes with the same UID. In
// most cases this means "from the same APK".
class InternalOnlySecurityPolicy : public SecurityPolicy {
public:
InternalOnlySecurityPolicy();
~InternalOnlySecurityPolicy() override;
bool IsAuthorized(int uid) override;
};
#ifdef GPR_ANDROID
// EXPERIMENTAL Only allows the connections from the APK that have the same
// signature.
class SameSignatureSecurityPolicy : public SecurityPolicy {
public:
// `context` is required for getting PackageManager Java class
SameSignatureSecurityPolicy(JavaVM* jvm, jobject context);
~SameSignatureSecurityPolicy() override;
bool IsAuthorized(int uid) override;
private:
JavaVM* jvm_;
jobject context_;
};
#endif
} // namespace binder
} // namespace experimental
} // namespace grpc
#endif // GRPCPP_SECURITY_BINDER_SECURITY_POLICY_H

1
package.xml generated

@ -1686,6 +1686,7 @@
<file baseinstalldir="/" name="src/core/load_balancing/xds/xds_wrr_locality.cc" role="src" />
<file baseinstalldir="/" name="src/core/plugin_registry/grpc_plugin_registry.cc" role="src" />
<file baseinstalldir="/" name="src/core/plugin_registry/grpc_plugin_registry_extra.cc" role="src" />
<file baseinstalldir="/" name="src/core/resolver/binder/binder_resolver.cc" role="src" />
<file baseinstalldir="/" name="src/core/resolver/dns/c_ares/dns_resolver_ares.cc" role="src" />
<file baseinstalldir="/" name="src/core/resolver/dns/c_ares/dns_resolver_ares.h" role="src" />
<file baseinstalldir="/" name="src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h" role="src" />

@ -33,7 +33,10 @@ package(
# the top-level BUILD file that have not yet been moved here. Should go away
# once the transition is complete.
exports_files(
glob(["**"]),
glob(
["**"],
exclude = ["ext/transport/binder/java/**"],
),
visibility = ["//:__subpackages__"],
)
@ -7155,6 +7158,33 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "grpc_resolver_binder",
srcs = [
"resolver/binder/binder_resolver.cc",
],
external_deps = [
"absl/log:log",
"absl/status",
"absl/status:statusor",
"absl/strings",
],
language = "c++",
deps = [
"channel_args",
"error",
"iomgr_port",
"resolved_address",
"status_helper",
"//:config",
"//:endpoint_addresses",
"//:gpr",
"//:grpc_resolver",
"//:orphanable",
"//:uri",
],
)
grpc_cc_library(
name = "grpc_resolver_xds_attributes",
hdrs = [

@ -0,0 +1,10 @@
# Binder transport for cross process IPC on Android
EXPERIMENTAL. API stability not guaranteed.
This transport implements
[BinderChannel for native cross-process communication on Android](https://github.com/grpc/proposal/blob/master/L73-java-binderchannel.md) and enables C++/Java cross-process communication on Android with gRPC.
Tests: https://github.com/grpc/grpc/tree/master/test/core/transport/binder/
Example apps: https://github.com/grpc/grpc/tree/master/examples/android/binder/java/io/grpc/binder/cpp

@ -0,0 +1,42 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_CLIENT_CHANNEL_CREATE_IMPL_H
#define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_CLIENT_CHANNEL_CREATE_IMPL_H
#include <grpc/support/port_platform.h>
#include <grpcpp/security/binder_security_policy.h>
#include "src/core/ext/transport/binder/wire_format/binder.h"
#include "src/core/lib/channel/channel_args.h"
namespace grpc {
namespace internal {
// Creates a GRPC_CLIENT_DIRECT_CHANNEL channel from endpoint binder
// At this moment this is only used for testing.
grpc_channel* CreateDirectBinderChannelImplForTesting(
std::unique_ptr<grpc_binder::Binder> endpoint_binder,
const grpc_channel_args* args,
std::shared_ptr<grpc::experimental::binder::SecurityPolicy>
security_policy);
// Creates a GRPC_CLIENT_CHANNEL channel
grpc_channel* CreateClientBinderChannelImpl(std::string target,
const grpc_channel_args* args);
} // namespace internal
} // namespace grpc
#endif // GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_CLIENT_CHANNEL_CREATE_IMPL_H

@ -0,0 +1,69 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/core/ext/transport/binder/client/connection_id_generator.h"
#include <grpc/support/port_platform.h>
#ifndef GRPC_NO_BINDER
#include "absl/log/check.h"
#include "absl/strings/str_cat.h"
namespace {
// Make sure `s` does not contain characters other than numbers, alphabets,
// period and underscore
std::string Normalize(absl::string_view str_view) {
std::string s = std::string(str_view);
for (size_t i = 0; i < s.length(); i++) {
if (!isalnum(s[i]) && s[i] != '.') {
s[i] = '_';
}
}
return s;
}
// Remove prefix of the string if the string is longer than len
std::string StripToLength(const std::string& s, size_t len) {
if (s.length() > len) {
return s.substr(s.length() - len, len);
}
return s;
}
} // namespace
namespace grpc_binder {
std::string ConnectionIdGenerator::Generate(absl::string_view uri) {
// reserve some room for serial number
const size_t kReserveForNumbers = 15;
std::string s =
StripToLength(Normalize(uri), kPathLengthLimit - kReserveForNumbers);
std::string ret;
{
grpc_core::MutexLock l(&m_);
// Insert a hyphen before serial number
ret = absl::StrCat(s, "-", ++count_);
}
CHECK_LT(ret.length(), kPathLengthLimit);
return ret;
}
ConnectionIdGenerator* GetConnectionIdGenerator() {
static ConnectionIdGenerator* cig = new ConnectionIdGenerator();
return cig;
}
} // namespace grpc_binder
#endif

@ -0,0 +1,30 @@
# Copyright 2021 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# copybara: Import internal android_library rule here
licenses(["notice"])
android_library(
name = "connection_helper",
srcs = [
"GrpcBinderConnection.java",
"GrpcCppServerBuilder.java",
"NativeConnectionHelper.java",
],
visibility = ["//visibility:public"],
deps = [
# copybara: Add proguard dependency here
],
)

@ -0,0 +1,104 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package io.grpc.binder.cpp;
import static android.content.Intent.URI_ANDROID_APP_SCHEME;
import static android.content.Intent.URI_INTENT_SCHEME;
import android.annotation.TargetApi;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.util.Log;
import java.net.URISyntaxException;
/* Handles the binder connection state with OnDeviceServer server */
public class GrpcBinderConnection implements ServiceConnection {
private static final String logTag = "GrpcBinderConnection";
private Context mContext;
private IBinder mService;
// A string that identifies this service connection
private final String mConnId;
public GrpcBinderConnection(Context context, String connId) {
mContext = context;
mConnId = connId;
}
@Override
public void onNullBinding(ComponentName className) {
// TODO(mingcl): Notify C++ that the connection is never going to happen
Log.e(logTag, "Service returned null IBinder. mConnId = " + mConnId);
}
@Override
public void onServiceConnected(ComponentName className, IBinder service) {
Log.e(logTag, "Service has connected. mConnId = " + mConnId);
if (service == null) {
// This should not happen since onNullBinding should be invoked instead
throw new IllegalArgumentException("service was null");
}
synchronized (this) {
mService = service;
}
notifyConnected(mConnId, mService);
}
@Override
public void onServiceDisconnected(ComponentName className) {
Log.e(logTag, "Service has disconnected. mConnId = " + mConnId);
}
public void tryConnect(String pkg, String cls, String action_name) {
Intent intent = new Intent(action_name);
ComponentName compName = new ComponentName(pkg, cls);
intent.setComponent(compName);
tryConnect(intent);
}
@TargetApi(22)
public void tryConnect(String uri) {
// Try connect with an URI that can be parsed as intent.
try {
tryConnect(Intent.parseUri(uri, URI_ANDROID_APP_SCHEME | URI_INTENT_SCHEME));
} catch (URISyntaxException e) {
Log.e(logTag, "Unable to parse the Uri: " + uri);
}
}
private void tryConnect(Intent intent) {
synchronized (this) {
// Will return true if the system is in the process of bringing up a service that your client
// has permission to bind to; false if the system couldn't find the service or if your client
// doesn't have permission to bind to it
boolean result = mContext.bindService(intent, this, Context.BIND_AUTO_CREATE);
if (result) {
Log.e(logTag, "bindService returns ok");
} else {
Log.e(
logTag,
"bindService failed. Maybe the system couldn't find the service or the"
+ " client doesn't have permission to bind to it.");
}
}
}
// Calls a function defined in endpoint_binder_pool.cc
private static native void notifyConnected(String connId, IBinder service);
}

@ -0,0 +1,40 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package io.grpc.binder.cpp;
import android.os.IBinder;
import android.util.Log;
/* EXPERIMENTAL. Provides a interface to get endpoint binder from C++ */
public class GrpcCppServerBuilder {
private static final String logTag = "GrpcCppServerBuilder";
public static IBinder GetEndpointBinder(String uri) {
String scheme = "binder:";
if (uri.startsWith(scheme)) {
String path = uri.substring(scheme.length());
// TODO(mingcl): Consider if we would like to make sure the path only contain valid
// characters here
IBinder ibinder = GetEndpointBinderInternal(path);
Log.e(logTag, "Returning binder=" + ibinder + " for URI=" + uri);
return ibinder;
} else {
Log.e(logTag, "URI " + uri + " does not start with 'binder:'");
return null;
}
}
private static native IBinder GetEndpointBinderInternal(String conn_id);
}

@ -0,0 +1,71 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package io.grpc.binder.cpp;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Parcel;
import android.util.Log;
// copybara: Import proguard UsedByNative annotation here
import java.util.HashMap;
import java.util.Map;
/**
* This class will be invoked by gRPC binder transport internal implementation (from
* src/core/ext/transport/binder/client/jni_utils.cc) to perform operations that are only possible
* in Java
*/
// copybara: Add @UsedByNative("jni_utils.cc")
final class NativeConnectionHelper {
// Maps connection id to GrpcBinderConnection instances
static Map<String, GrpcBinderConnection> connectionIdToGrpcBinderConnectionMap = new HashMap<>();
// copybara: Add @UsedByNative("jni_utils.cc")
static void tryEstablishConnection(
Context context, String pkg, String cls, String actionName, String connId) {
// TODO(mingcl): Assert that connId is unique
connectionIdToGrpcBinderConnectionMap.put(connId, new GrpcBinderConnection(context, connId));
connectionIdToGrpcBinderConnectionMap.get(connId).tryConnect(pkg, cls, actionName);
}
// copybara: Add @UsedByNative("jni_utils.cc")
static void tryEstablishConnectionWithUri(Context context, String uri, String connId) {
// TODO(mingcl): Assert that connId is unique
connectionIdToGrpcBinderConnectionMap.put(connId, new GrpcBinderConnection(context, connId));
connectionIdToGrpcBinderConnectionMap.get(connId).tryConnect(uri);
}
// Returns true if the packages signature of the 2 UIDs match.
// `context` is used to get PackageManager.
// Suppress unnecessary internal warnings related to checkSignatures compatibility issue.
// BinderTransport code is only used on newer Android platform versions so this is fine.
@SuppressWarnings("CheckSignatures")
// copybara: Add @UsedByNative("jni_utils.cc")
static boolean isSignatureMatch(Context context, int uid1, int uid2) {
int result = context.getPackageManager().checkSignatures(uid1, uid2);
if (result == PackageManager.SIGNATURE_MATCH) {
return true;
}
Log.e(
"NativeConnectionHelper",
"Signatures does not match. checkSignature return value = " + result);
return false;
}
// copybara: Add @UsedByNative("jni_utils.cc")
static Parcel getEmptyParcel() {
return Parcel.obtain();
}
}

@ -0,0 +1,40 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_SECURITY_POLICY_SECURITY_POLICY_H
#define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_SECURITY_POLICY_SECURITY_POLICY_H
#include <grpc/support/port_platform.h>
namespace grpc {
namespace experimental {
namespace binder {
// This interface is for determining if a connection is allowed to be
// established on Android. See https://source.android.com/security/app-sandbox
// for more info about UID.
class SecurityPolicy {
public:
virtual ~SecurityPolicy() = default;
// Returns true if the UID is authorized to connect.
// Must return the same value for the same inputs so callers can safely cache
// the result.
virtual bool IsAuthorized(int uid) = 0;
};
} // namespace binder
} // namespace experimental
} // namespace grpc
#endif // GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_SECURITY_POLICY_SECURITY_POLICY_H

@ -0,0 +1,117 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_TRANSPORT_BINDER_STREAM_H
#define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_TRANSPORT_BINDER_STREAM_H
#include <grpc/support/port_platform.h>
#include "src/core/ext/transport/binder/transport/binder_transport.h"
struct RecvInitialMetadataArgs {
grpc_binder_stream* stream;
grpc_binder_transport* transport;
int tx_code;
absl::StatusOr<grpc_binder::Metadata> initial_metadata;
};
struct RecvMessageArgs {
grpc_binder_stream* stream;
grpc_binder_transport* transport;
int tx_code;
absl::StatusOr<std::string> message;
};
struct RecvTrailingMetadataArgs {
grpc_binder_stream* stream;
grpc_binder_transport* transport;
int tx_code;
absl::StatusOr<grpc_binder::Metadata> trailing_metadata;
int status;
};
struct RegisterStreamArgs {
grpc_binder_stream* stream;
grpc_binder_transport* transport;
};
// TODO(mingcl): Figure out if we want to use class instead of struct here
struct grpc_binder_stream {
// server_data will be null for client, and for server it will be whatever
// passed in to the accept_stream_fn callback by client.
grpc_binder_stream(grpc_binder_transport* t, grpc_stream_refcount* refcount,
const void* /*server_data*/, grpc_core::Arena* arena,
int tx_code, bool is_client)
: t(t),
refcount(refcount),
arena(arena),
tx_code(tx_code),
is_client(is_client),
is_closed(false) {
recv_initial_metadata_args.stream = this;
recv_initial_metadata_args.transport = t;
recv_message_args.stream = this;
recv_message_args.transport = t;
recv_trailing_metadata_args.stream = this;
recv_trailing_metadata_args.transport = t;
}
~grpc_binder_stream() {
if (destroy_stream_then_closure != nullptr) {
grpc_core::ExecCtx::Run(DEBUG_LOCATION, destroy_stream_then_closure,
absl::OkStatus());
}
}
int GetTxCode() const { return tx_code; }
grpc_binder_transport* t;
grpc_stream_refcount* refcount;
grpc_core::Arena* arena;
int tx_code;
const bool is_client;
bool is_closed;
grpc_closure* destroy_stream_then_closure = nullptr;
grpc_closure destroy_stream;
// The reason why this stream is cancelled and closed.
grpc_error_handle cancel_self_error;
grpc_closure recv_initial_metadata_closure;
RecvInitialMetadataArgs recv_initial_metadata_args;
grpc_closure recv_message_closure;
RecvMessageArgs recv_message_args;
grpc_closure recv_trailing_metadata_closure;
RecvTrailingMetadataArgs recv_trailing_metadata_args;
grpc_closure register_stream_closure;
RegisterStreamArgs register_stream_args;
// We store these fields passed from op batch, in order to access them through
// grpc_binder_stream
grpc_metadata_batch* recv_initial_metadata;
grpc_closure* recv_initial_metadata_ready = nullptr;
bool* trailing_metadata_available = nullptr;
absl::optional<grpc_core::SliceBuffer>* recv_message;
grpc_closure* recv_message_ready = nullptr;
bool* call_failed_before_recv_message = nullptr;
grpc_metadata_batch* recv_trailing_metadata;
grpc_closure* recv_trailing_metadata_finished = nullptr;
bool trailing_metadata_sent = false;
bool need_to_call_trailing_metadata_callback = false;
};
#endif // GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_TRANSPORT_BINDER_STREAM_H

@ -0,0 +1,76 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_UTILS_BINDER_AUTO_UTILS_H
#define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_UTILS_BINDER_AUTO_UTILS_H
#include <grpc/support/port_platform.h>
#ifdef GPR_SUPPORT_BINDER_TRANSPORT
#include "src/core/ext/transport/binder/utils/ndk_binder.h"
namespace grpc_binder {
namespace ndk_util {
///
/// Represents one strong pointer to an AIBinder object.
/// Copied from binder/ndk/include_cpp/android/binder_auto_utils.h
///
class SpAIBinder {
public:
SpAIBinder() : mBinder(nullptr) {}
explicit SpAIBinder(AIBinder* binder) : mBinder(binder) {}
SpAIBinder(std::nullptr_t)
: SpAIBinder() {} // NOLINT(google-explicit-constructor)
SpAIBinder(const SpAIBinder& other) { *this = other; }
~SpAIBinder() { set(nullptr); }
SpAIBinder& operator=(const SpAIBinder& other) {
if (this == &other) {
return *this;
}
AIBinder_incStrong(other.mBinder);
set(other.mBinder);
return *this;
}
void set(AIBinder* binder) {
AIBinder* old = *const_cast<AIBinder* volatile*>(&mBinder);
if (old != nullptr) AIBinder_decStrong(old);
if (old != *const_cast<AIBinder* volatile*>(&mBinder)) {
__assert(__FILE__, __LINE__, "Race detected.");
}
mBinder = binder;
}
AIBinder* get() const { return mBinder; }
AIBinder** getR() { return &mBinder; }
bool operator!=(const SpAIBinder& rhs) const { return get() != rhs.get(); }
bool operator<(const SpAIBinder& rhs) const { return get() < rhs.get(); }
bool operator<=(const SpAIBinder& rhs) const { return get() <= rhs.get(); }
bool operator==(const SpAIBinder& rhs) const { return get() == rhs.get(); }
bool operator>(const SpAIBinder& rhs) const { return get() > rhs.get(); }
bool operator>=(const SpAIBinder& rhs) const { return get() >= rhs.get(); }
private:
AIBinder* mBinder = nullptr;
};
} // namespace ndk_util
} // namespace grpc_binder
#endif
#endif // GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_UTILS_BINDER_AUTO_UTILS_H

@ -0,0 +1,107 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_UTILS_NDK_BINDER_H
#define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_UTILS_NDK_BINDER_H
#include <grpc/support/port_platform.h>
#ifdef GPR_SUPPORT_BINDER_TRANSPORT
#include <assert.h>
#include <jni.h>
#include <memory>
// This file defines NdkBinder functions, variables, and types in
// grpc_binder::ndk_util namespace. This allows us to dynamically load
// libbinder_ndk at runtime, and make it possible to compile the code without
// the library present at compile time.
// TODO(mingcl): Consider if we want to check API level and include NDK headers
// normally if the level is high enough
namespace grpc_binder {
namespace ndk_util {
struct AIBinder;
struct AParcel;
struct AIBinder_Class;
// Only enum values used by the project is defined here
enum {
FLAG_ONEWAY = 0x01,
};
enum {
STATUS_OK = 0,
STATUS_UNKNOWN_ERROR = (-2147483647 - 1),
};
typedef int32_t binder_status_t;
typedef uint32_t binder_flags_t;
typedef uint32_t transaction_code_t;
typedef bool (*AParcel_byteArrayAllocator)(void* arrayData, int32_t length,
int8_t** outBuffer);
typedef bool (*AParcel_stringAllocator)(void* stringData, int32_t length,
char** buffer);
typedef void* (*AIBinder_Class_onCreate)(void* args);
typedef void (*AIBinder_Class_onDestroy)(void* userData);
typedef binder_status_t (*AIBinder_Class_onTransact)(AIBinder* binder,
transaction_code_t code,
const AParcel* in,
AParcel* out);
void AIBinder_Class_disableInterfaceTokenHeader(AIBinder_Class* clazz);
void* AIBinder_getUserData(AIBinder* binder);
uid_t AIBinder_getCallingUid();
AIBinder* AIBinder_fromJavaBinder(JNIEnv* env, jobject binder);
AIBinder_Class* AIBinder_Class_define(const char* interfaceDescriptor,
AIBinder_Class_onCreate onCreate,
AIBinder_Class_onDestroy onDestroy,
AIBinder_Class_onTransact onTransact);
AIBinder* AIBinder_new(const AIBinder_Class* clazz, void* args);
bool AIBinder_associateClass(AIBinder* binder, const AIBinder_Class* clazz);
void AIBinder_incStrong(AIBinder* binder);
void AIBinder_decStrong(AIBinder* binder);
binder_status_t AIBinder_transact(AIBinder* binder, transaction_code_t code,
AParcel** in, AParcel** out,
binder_flags_t flags);
binder_status_t AParcel_readByteArray(const AParcel* parcel, void* arrayData,
AParcel_byteArrayAllocator allocator);
void AParcel_delete(AParcel* parcel);
int32_t AParcel_getDataSize(const AParcel* parcel);
binder_status_t AParcel_writeInt32(AParcel* parcel, int32_t value);
binder_status_t AParcel_writeInt64(AParcel* parcel, int64_t value);
binder_status_t AParcel_writeStrongBinder(AParcel* parcel, AIBinder* binder);
binder_status_t AParcel_writeString(AParcel* parcel, const char* string,
int32_t length);
binder_status_t AParcel_readInt32(const AParcel* parcel, int32_t* value);
binder_status_t AParcel_readInt64(const AParcel* parcel, int64_t* value);
binder_status_t AParcel_readString(const AParcel* parcel, void* stringData,
AParcel_stringAllocator allocator);
binder_status_t AParcel_readStrongBinder(const AParcel* parcel,
AIBinder** binder);
binder_status_t AParcel_writeByteArray(AParcel* parcel, const int8_t* arrayData,
int32_t length);
binder_status_t AIBinder_prepareTransaction(AIBinder* binder, AParcel** in);
jobject AIBinder_toJavaBinder(JNIEnv* env, AIBinder* binder);
} // namespace ndk_util
} // namespace grpc_binder
#endif // GPR_SUPPORT_BINDER_TRANSPORT
#endif // GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_UTILS_NDK_BINDER_H

@ -0,0 +1,29 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <grpc/support/port_platform.h>
#ifndef GRPC_NO_BINDER
#include "src/core/ext/transport/binder/wire_format/binder_constants.h"
ABSL_CONST_INIT const int FIRST_CALL_TRANSACTION = 0x00000001;
ABSL_CONST_INIT const int LAST_CALL_TRANSACTION = 0x00FFFFFF;
namespace grpc_binder {
ABSL_CONST_INIT const int kFirstCallId = FIRST_CALL_TRANSACTION + 1000;
} // namespace grpc_binder
#endif

@ -0,0 +1,33 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <grpc/support/port_platform.h>
#ifndef GRPC_NO_BINDER
#include "src/core/ext/transport/binder/wire_format/transaction.h"
namespace grpc_binder {
ABSL_CONST_INIT const int kFlagPrefix = 0x1;
ABSL_CONST_INIT const int kFlagMessageData = 0x2;
ABSL_CONST_INIT const int kFlagSuffix = 0x4;
ABSL_CONST_INIT const int kFlagOutOfBandClose = 0x8;
ABSL_CONST_INIT const int kFlagExpectSingleMessage = 0x10;
ABSL_CONST_INIT const int kFlagStatusDescription = 0x20;
ABSL_CONST_INIT const int kFlagMessageDataIsParcelable = 0x40;
ABSL_CONST_INIT const int kFlagMessageDataIsPartial = 0x80;
} // namespace grpc_binder
#endif

@ -72,6 +72,9 @@ extern void RegisterLoadBalancedCallDestination(
#ifndef GRPC_NO_RLS
extern void RegisterRlsLbPolicy(CoreConfiguration::Builder* builder);
#endif // !GRPC_NO_RLS
#ifdef GPR_SUPPORT_BINDER_TRANSPORT
extern void RegisterBinderResolver(CoreConfiguration::Builder* builder);
#endif
namespace {
@ -119,6 +122,9 @@ void BuildCoreConfiguration(CoreConfiguration::Builder* builder) {
RegisterFakeResolver(builder);
RegisterHttpProxyMapper(builder);
RegisterLoadBalancedCallDestination(builder);
#ifdef GPR_SUPPORT_BINDER_TRANSPORT
RegisterBinderResolver(builder);
#endif
#ifndef GRPC_NO_RLS
RegisterRlsLbPolicy(builder);
#endif // !GRPC_NO_RLS

@ -0,0 +1,9 @@
Support for resolving the scheme used by binder transport implementation.
The URI's authority is required to be empty.
The path is used as the identifiers of endpoint binder objects and the length
limit of the identifier is the same as unix socket length limit.
The length limit of the path should at least be 100 characters long. This is
guaranteed by `static_assert` in the implementation.

@ -704,6 +704,7 @@ CORE_SOURCE_FILES = [
'src/core/load_balancing/xds/xds_wrr_locality.cc',
'src/core/plugin_registry/grpc_plugin_registry.cc',
'src/core/plugin_registry/grpc_plugin_registry_extra.cc',
'src/core/resolver/binder/binder_resolver.cc',
'src/core/resolver/dns/c_ares/dns_resolver_ares.cc',
'src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc',
'src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc',

@ -36,6 +36,22 @@ grpc_cc_test(
],
)
grpc_cc_test(
name = "binder_resolver_test",
srcs = ["binder_resolver_test.cc"],
external_deps = [
"absl/log:log",
"gtest",
],
language = "C++",
deps = [
"//:gpr",
"//:grpc",
"//src/core:grpc_resolver_binder",
"//test/core/test_util:grpc_test_util",
],
)
grpc_cc_test(
name = "dns_resolver_test",
srcs = ["dns_resolver_test.cc"],

@ -0,0 +1,133 @@
# Copyright 2021 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
licenses(["notice"])
grpc_package(
name = "test/core/transport/binder",
visibility = "tests",
)
grpc_cc_library(
name = "mock_objects",
testonly = 1,
srcs = ["mock_objects.cc"],
hdrs = ["mock_objects.h"],
external_deps = [
"absl/memory",
"gtest",
],
language = "C++",
deps = [
"//:grpc++_binder",
],
)
grpc_cc_test(
name = "wire_writer_test",
srcs = ["wire_writer_test.cc"],
external_deps = [
"absl/memory",
"gtest",
],
language = "C++",
tags = ["no_test_ios"],
uses_event_engine = False,
uses_polling = False,
deps = [
":mock_objects",
"//:grpc++_binder",
"//test/core/test_util:grpc_test_util",
],
)
grpc_cc_test(
name = "wire_reader_test",
srcs = ["wire_reader_test.cc"],
external_deps = [
"absl/memory",
"gtest",
],
language = "C++",
tags = ["no_test_ios"],
uses_event_engine = False,
uses_polling = False,
deps = [
":mock_objects",
"//:grpc++_binder",
"//test/core/test_util:grpc_test_util",
],
)
grpc_cc_test(
name = "transport_stream_receiver_test",
srcs = ["transport_stream_receiver_test.cc"],
external_deps = [
"absl/memory",
"gtest",
],
language = "C++",
tags = ["no_test_ios"],
uses_event_engine = False,
uses_polling = False,
deps = [
"//:grpc++_binder",
"//test/core/test_util:grpc_test_util",
],
)
grpc_cc_test(
name = "binder_transport_test",
srcs = ["binder_transport_test.cc"],
external_deps = [
"absl/memory",
"absl/strings",
"gtest",
],
language = "C++",
tags = [
# To avoid `symbolizer buffer too small` warning of UBSAN
"noubsan",
"no_test_ios",
],
uses_event_engine = False,
uses_polling = False,
deps = [
":mock_objects",
"//:grpc",
"//:grpc++_binder",
"//test/core/test_util:grpc_test_util",
],
)
grpc_cc_test(
name = "endpoint_binder_pool_test",
srcs = ["endpoint_binder_pool_test.cc"],
external_deps = [
"absl/memory",
"gtest",
],
language = "C++",
tags = ["no_test_ios"],
uses_event_engine = False,
uses_polling = False,
deps = [
":mock_objects",
"//:grpc",
"//:grpc++_binder",
"//test/core/test_util:grpc_test_util",
],
)

@ -0,0 +1,119 @@
# Copyright 2021 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
licenses(["notice"])
grpc_package(
name = "test/core/transport/binder/end2end",
visibility = "tests",
)
grpc_cc_library(
name = "fake_binder",
testonly = 1,
srcs = ["fake_binder.cc"],
hdrs = ["fake_binder.h"],
external_deps = [
"absl/log:log",
"absl/memory",
"absl/random",
"absl/strings",
"absl/strings:str_format",
"absl/time",
"absl/types:variant",
],
deps = [
"//:gpr",
"//:grpc++_binder",
],
)
grpc_cc_test(
name = "fake_binder_test",
srcs = ["fake_binder_test.cc"],
external_deps = [
"absl/strings",
"absl/time",
"gtest",
],
language = "C++",
tags = ["no_test_ios"],
uses_event_engine = False,
uses_polling = False,
deps = [
":fake_binder",
"//test/core/test_util:grpc_test_util",
],
)
grpc_cc_library(
name = "end2end_binder_channel",
testonly = 1,
srcs = ["testing_channel_create.cc"],
hdrs = ["testing_channel_create.h"],
external_deps = ["absl/log:check"],
deps = [
":fake_binder",
"//:grpc++_base",
"//:grpc++_binder",
"//:grpc_base",
"//src/core:channel_args",
],
)
grpc_cc_test(
name = "end2end_binder_transport_test",
srcs = ["end2end_binder_transport_test.cc"],
external_deps = [
"absl/memory",
"absl/time",
"gtest",
],
flaky = True,
language = "C++",
tags = [
# Flaky on windows
"no_windows",
"no_mac",
"no_test_ios",
# Known race between stream creation and cancellation
"notsan",
],
deps = [
":end2end_binder_channel",
":fake_binder",
"//:grpc++_binder",
"//test/core/test_util:grpc_test_util",
"//test/cpp/end2end:test_service_impl",
],
)
grpc_cc_test(
name = "binder_server_test",
srcs = ["binder_server_test.cc"],
external_deps = [
"gtest",
],
tags = ["no_test_ios"],
deps = [
"//:grpc++",
"//:grpc++_binder",
"//test/core/test_util:grpc_test_util",
"//test/core/transport/binder/end2end:fake_binder",
"//test/cpp/end2end:test_service_impl",
],
)

@ -0,0 +1,101 @@
# Copyright 2021 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_package", "grpc_proto_library")
load("//test/core/test_util:grpc_fuzzer.bzl", "grpc_proto_fuzzer")
grpc_package(
name = "test/core/transport/binder/end2end/fuzzers",
features = [
"layering_check",
],
)
licenses(["notice"])
# Protobuf messages for generating inputs. We manually define proto
# library rule here so the same proto file can be shared between multiple
# grpc_proto_fuzzer targets
grpc_proto_library(
name = "binder_transport_fuzzer_proto",
srcs = ["binder_transport_fuzzer.proto"],
)
grpc_cc_library(
name = "fuzzer_utils",
srcs = ["fuzzer_utils.cc"],
external_deps = [
"absl/log:check",
"absl/log:log",
],
language = "c++",
public_hdrs = ["fuzzer_utils.h"],
deps = [
"binder_transport_fuzzer_proto",
"//:gpr",
"//:grpc++",
"//:grpc++_base",
"//:grpc_base",
"//test/core/test_util:grpc_test_util",
],
)
grpc_proto_fuzzer(
name = "binder_transport_client_fuzzer",
srcs = [
"client_fuzzer.cc",
],
corpus = "binder_transport_client_fuzzer_corpus",
external_deps = ["absl/log:check"],
owner = "binder",
proto = "client.proto",
tags = [
"no_mac",
"no_windows",
],
deps = [
"binder_transport_fuzzer_proto",
":fuzzer_utils",
"//:gpr",
"//:grpc++",
"//:grpc++_base",
"//:grpc_base",
"//test/core/test_util:grpc_test_util",
],
)
grpc_proto_fuzzer(
name = "binder_transport_server_fuzzer",
srcs = [
"server_fuzzer.cc",
],
corpus = "binder_transport_server_fuzzer_corpus",
external_deps = ["absl/log:check"],
owner = "binder",
proto = "server.proto",
tags = [
"no_mac",
"no_windows",
],
deps = [
"binder_transport_fuzzer_proto",
":fuzzer_utils",
"//:gpr",
"//:grpc++",
"//:grpc++_base",
"//:grpc_base",
"//src/core:slice",
"//test/core/test_util:grpc_test_util",
],
)

@ -0,0 +1,81 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package binder_transport_fuzzer;
message Binder {}
message Value {
oneof data_type {
int32 i32 = 1;
int64 i64 = 2;
bytes byte_array = 3;
// Strings in Parcel could also contain non UTF-8 data so we use bytes
// to represent string here
bytes str = 4;
Binder binder = 5;
}
}
message Parcel {
repeated Value values = 1;
// Simulates the return value of AParcel_getDataSize
// (The value generated by protobuf libprotobuf-mutator might not always make sense
// but the transport implementation should handle that)
int32 data_size = 2;
}
enum TransactionCode {
INVALID = 0;
SETUP_TRANSPORT = 1;
SHUTDOWN_TRANSPORT = 2;
ACKNOWLEDGE_BYTES = 3;
PING = 4;
PING_RESPONSE = 5;
}
message Transaction {
TransactionCode code = 1;
int32 uid = 2;
Parcel parcel = 3;
}
// Special parcel that used for setting up transport.
// TODO(mingcl): Consider also fuzzing the setup transport code path
message SetupTransportParcel {
int32 version = 1;
// Simulates the return value of AParcel_getDataSize
// (The value generated by protobuf libprotobuf-mutator might not always make sense
// but the transport implementation should handle that)
int32 data_size = 2;
}
message SetupTransportTransaction {
int32 uid = 1;
SetupTransportParcel parcel = 2;
}
message IncomingParcels {
SetupTransportTransaction setup_transport_transaction = 1;
repeated Transaction transactions = 2;
}
message Input {
IncomingParcels incoming_parcels = 1;
}

@ -0,0 +1,17 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package binder_transport_fuzzer;

@ -0,0 +1,157 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "test/core/transport/binder/end2end/fuzzers/fuzzer_utils.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
namespace grpc_binder {
namespace fuzzing {
namespace {
std::thread* g_fuzzing_thread = nullptr;
template <typename... Args>
void CreateFuzzingThread(Args&&... args) {
CHECK_EQ(g_fuzzing_thread, nullptr);
g_fuzzing_thread = new std::thread(std::forward<Args>(args)...);
}
} // namespace
void JoinFuzzingThread() {
if (g_fuzzing_thread) {
g_fuzzing_thread->join();
delete g_fuzzing_thread;
g_fuzzing_thread = nullptr;
}
}
int32_t ReadableParcelForFuzzing::GetDataSize() const {
return parcel_data_size_;
}
absl::Status ReadableParcelForFuzzing::ReadInt32(int32_t* data) {
if (consumed_data_size_ >= kParcelDataSizeLimit) {
return absl::InternalError("Parcel size limit exceeds");
}
if (values_.empty() || !values_.front().has_i32()) {
return absl::InternalError("error");
}
*data = values_.front().i32();
values_.pop();
consumed_data_size_ += sizeof(int32_t);
return absl::OkStatus();
}
absl::Status ReadableParcelForFuzzing::ReadInt64(int64_t* data) {
if (consumed_data_size_ >= kParcelDataSizeLimit) {
return absl::InternalError("Parcel size limit exceeds");
}
if (values_.empty() || !values_.front().has_i64()) {
return absl::InternalError("error");
}
*data = values_.front().i64();
values_.pop();
consumed_data_size_ += sizeof(int64_t);
return absl::OkStatus();
}
absl::Status ReadableParcelForFuzzing::ReadBinder(
std::unique_ptr<Binder>* binder) {
if (consumed_data_size_ >= kParcelDataSizeLimit) {
return absl::InternalError("Parcel size limit exceeds");
}
if (values_.empty() || !values_.front().has_binder()) {
return absl::InternalError("error");
}
*binder = std::make_unique<BinderForFuzzing>();
values_.pop();
consumed_data_size_ += sizeof(void*);
return absl::OkStatus();
}
absl::Status ReadableParcelForFuzzing::ReadByteArray(std::string* data) {
if (consumed_data_size_ >= kParcelDataSizeLimit) {
return absl::InternalError("Parcel size limit exceeds");
}
if (values_.empty() || !values_.front().has_byte_array()) {
return absl::InternalError("error");
}
*data = values_.front().byte_array();
values_.pop();
consumed_data_size_ += data->size();
return absl::OkStatus();
}
absl::Status ReadableParcelForFuzzing::ReadString(std::string* data) {
if (consumed_data_size_ >= kParcelDataSizeLimit) {
return absl::InternalError("Parcel size limit exceeds");
}
if (values_.empty() || !values_.front().has_str()) {
return absl::InternalError("error");
}
*data = values_.front().str();
values_.pop();
consumed_data_size_ += data->size();
return absl::OkStatus();
}
void FuzzingLoop(
binder_transport_fuzzer::IncomingParcels incoming_parcels,
grpc_core::RefCountedPtr<grpc_binder::WireReader> wire_reader_ref,
grpc_binder::TransactionReceiver::OnTransactCb callback) {
{
// Send SETUP_TRANSPORT request.
std::unique_ptr<grpc_binder::ReadableParcel> parcel =
std::make_unique<ReadableParcelForFuzzing>(
incoming_parcels.setup_transport_transaction().parcel());
callback(static_cast<transaction_code_t>(
grpc_binder::BinderTransportTxCode::SETUP_TRANSPORT),
parcel.get(),
/*uid=*/incoming_parcels.setup_transport_transaction().uid())
.IgnoreError();
}
for (const auto& tx_iter : incoming_parcels.transactions()) {
transaction_code_t tx_code = tx_iter.code();
std::unique_ptr<grpc_binder::ReadableParcel> parcel =
std::make_unique<ReadableParcelForFuzzing>(tx_iter.parcel());
callback(tx_code, parcel.get(),
/*uid=*/tx_iter.uid())
.IgnoreError();
}
wire_reader_ref = nullptr;
}
TransactionReceiverForFuzzing::TransactionReceiverForFuzzing(
binder_transport_fuzzer::IncomingParcels incoming_parcels,
grpc_core::RefCountedPtr<WireReader> wire_reader_ref,
TransactionReceiver::OnTransactCb cb) {
LOG(INFO) << "Construct TransactionReceiverForFuzzing";
CreateFuzzingThread(FuzzingLoop, std::move(incoming_parcels),
std::move(wire_reader_ref), std::move(cb));
}
std::unique_ptr<TransactionReceiver> BinderForFuzzing::ConstructTxReceiver(
grpc_core::RefCountedPtr<WireReader> wire_reader_ref,
TransactionReceiver::OnTransactCb cb) const {
auto tx_receiver = std::make_unique<TransactionReceiverForFuzzing>(
incoming_parcels_, wire_reader_ref, cb);
return tx_receiver;
}
} // namespace fuzzing
} // namespace grpc_binder

@ -0,0 +1,17 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package binder_transport_fuzzer;

@ -0,0 +1,55 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "test/core/transport/binder/mock_objects.h"
#include <memory>
#include "absl/memory/memory.h"
namespace grpc_binder {
using ::testing::Return;
MockReadableParcel::MockReadableParcel() {
ON_CALL(*this, ReadBinder).WillByDefault([](std::unique_ptr<Binder>* binder) {
*binder = std::make_unique<MockBinder>();
return absl::OkStatus();
});
ON_CALL(*this, ReadInt32).WillByDefault(Return(absl::OkStatus()));
ON_CALL(*this, ReadByteArray).WillByDefault(Return(absl::OkStatus()));
ON_CALL(*this, ReadString).WillByDefault(Return(absl::OkStatus()));
}
MockWritableParcel::MockWritableParcel() {
ON_CALL(*this, WriteInt32).WillByDefault(Return(absl::OkStatus()));
ON_CALL(*this, WriteBinder).WillByDefault(Return(absl::OkStatus()));
ON_CALL(*this, WriteString).WillByDefault(Return(absl::OkStatus()));
ON_CALL(*this, WriteByteArray).WillByDefault(Return(absl::OkStatus()));
}
MockBinder::MockBinder() {
ON_CALL(*this, PrepareTransaction).WillByDefault(Return(absl::OkStatus()));
ON_CALL(*this, Transact).WillByDefault(Return(absl::OkStatus()));
ON_CALL(*this, GetWritableParcel).WillByDefault(Return(&mock_input_));
ON_CALL(*this, ConstructTxReceiver)
.WillByDefault(
[this](grpc_core::RefCountedPtr<WireReader> /*wire_reader_ref*/,
TransactionReceiver::OnTransactCb cb) {
return std::make_unique<MockTransactionReceiver>(
cb, BinderTransportTxCode::SETUP_TRANSPORT, &mock_output_);
});
}
} // namespace grpc_binder

@ -0,0 +1,121 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPC_TEST_CORE_TRANSPORT_BINDER_MOCK_OBJECTS_H
#define GRPC_TEST_CORE_TRANSPORT_BINDER_MOCK_OBJECTS_H
#include <gmock/gmock.h>
#include "src/core/ext/transport/binder/utils/transport_stream_receiver.h"
#include "src/core/ext/transport/binder/wire_format/binder.h"
#include "src/core/ext/transport/binder/wire_format/binder_constants.h"
#include "src/core/ext/transport/binder/wire_format/wire_reader.h"
#include "src/core/ext/transport/binder/wire_format/wire_writer.h"
namespace grpc_binder {
class MockWritableParcel : public WritableParcel {
public:
MOCK_METHOD(int32_t, GetDataSize, (), (const, override));
MOCK_METHOD(absl::Status, WriteInt32, (int32_t), (override));
MOCK_METHOD(absl::Status, WriteInt64, (int64_t), (override));
MOCK_METHOD(absl::Status, WriteBinder, (HasRawBinder*), (override));
MOCK_METHOD(absl::Status, WriteString, (absl::string_view), (override));
MOCK_METHOD(absl::Status, WriteByteArray, (const int8_t*, int32_t),
(override));
MockWritableParcel();
};
class MockReadableParcel : public ReadableParcel {
public:
MOCK_METHOD(int32_t, GetDataSize, (), (const, override));
MOCK_METHOD(absl::Status, ReadInt32, (int32_t*), (override));
MOCK_METHOD(absl::Status, ReadInt64, (int64_t*), (override));
MOCK_METHOD(absl::Status, ReadBinder, (std::unique_ptr<Binder>*), (override));
MOCK_METHOD(absl::Status, ReadByteArray, (std::string*), (override));
MOCK_METHOD(absl::Status, ReadString, (std::string*), (override));
MockReadableParcel();
};
class MockBinder : public Binder {
public:
MOCK_METHOD(void, Initialize, (), (override));
MOCK_METHOD(absl::Status, PrepareTransaction, (), (override));
MOCK_METHOD(absl::Status, Transact, (BinderTransportTxCode), (override));
MOCK_METHOD(WritableParcel*, GetWritableParcel, (), (const, override));
MOCK_METHOD(std::unique_ptr<TransactionReceiver>, ConstructTxReceiver,
(grpc_core::RefCountedPtr<WireReader>,
TransactionReceiver::OnTransactCb),
(const, override));
MOCK_METHOD(void*, GetRawBinder, (), (override));
MockBinder();
MockWritableParcel& GetWriter() { return mock_input_; }
MockReadableParcel& GetReader() { return mock_output_; }
private:
MockWritableParcel mock_input_;
MockReadableParcel mock_output_;
};
// TODO(waynetu): Implement transaction injection later for more thorough
// testing.
class MockTransactionReceiver : public TransactionReceiver {
public:
explicit MockTransactionReceiver(OnTransactCb transact_cb,
BinderTransportTxCode code,
MockReadableParcel* output) {
if (code == BinderTransportTxCode::SETUP_TRANSPORT) {
EXPECT_CALL(*output, ReadInt32).WillOnce([](int32_t* version) {
*version = 1;
return absl::OkStatus();
});
}
transact_cb(static_cast<transaction_code_t>(code), output, /*uid=*/0)
.IgnoreError();
}
MOCK_METHOD(void*, GetRawBinder, (), (override));
};
class MockWireWriter : public WireWriter {
public:
MOCK_METHOD(absl::Status, RpcCall, (std::unique_ptr<Transaction>),
(override));
MOCK_METHOD(absl::Status, SendAck, (int64_t), (override));
MOCK_METHOD(void, OnAckReceived, (int64_t), (override));
};
class MockTransportStreamReceiver : public TransportStreamReceiver {
public:
MOCK_METHOD(void, RegisterRecvInitialMetadata,
(StreamIdentifier, InitialMetadataCallbackType), (override));
MOCK_METHOD(void, RegisterRecvMessage,
(StreamIdentifier, MessageDataCallbackType), (override));
MOCK_METHOD(void, RegisterRecvTrailingMetadata,
(StreamIdentifier, TrailingMetadataCallbackType), (override));
MOCK_METHOD(void, NotifyRecvInitialMetadata,
(StreamIdentifier, absl::StatusOr<Metadata>), (override));
MOCK_METHOD(void, NotifyRecvMessage,
(StreamIdentifier, absl::StatusOr<std::string>), (override));
MOCK_METHOD(void, NotifyRecvTrailingMetadata,
(StreamIdentifier, absl::StatusOr<Metadata>, int), (override));
MOCK_METHOD(void, CancelStream, (StreamIdentifier), (override));
};
} // namespace grpc_binder
#endif // GRPC_TEST_CORE_TRANSPORT_BINDER_MOCK_OBJECTS_H

@ -960,6 +960,7 @@ include/grpcpp/channel.h \
include/grpcpp/client_context.h \
include/grpcpp/completion_queue.h \
include/grpcpp/create_channel.h \
include/grpcpp/create_channel_binder.h \
include/grpcpp/create_channel_posix.h \
include/grpcpp/ext/call_metric_recorder.h \
include/grpcpp/ext/health_check_service_server_builder_option.h \
@ -1051,6 +1052,8 @@ include/grpcpp/security/audit_logging.h \
include/grpcpp/security/auth_context.h \
include/grpcpp/security/auth_metadata_processor.h \
include/grpcpp/security/authorization_policy_provider.h \
include/grpcpp/security/binder_credentials.h \
include/grpcpp/security/binder_security_policy.h \
include/grpcpp/security/credentials.h \
include/grpcpp/security/server_credentials.h \
include/grpcpp/security/tls_certificate_provider.h \

@ -960,6 +960,7 @@ include/grpcpp/channel.h \
include/grpcpp/client_context.h \
include/grpcpp/completion_queue.h \
include/grpcpp/create_channel.h \
include/grpcpp/create_channel_binder.h \
include/grpcpp/create_channel_posix.h \
include/grpcpp/ext/call_metric_recorder.h \
include/grpcpp/ext/health_check_service_server_builder_option.h \
@ -1051,6 +1052,8 @@ include/grpcpp/security/audit_logging.h \
include/grpcpp/security/auth_context.h \
include/grpcpp/security/auth_metadata_processor.h \
include/grpcpp/security/authorization_policy_provider.h \
include/grpcpp/security/binder_credentials.h \
include/grpcpp/security/binder_security_policy.h \
include/grpcpp/security/credentials.h \
include/grpcpp/security/server_credentials.h \
include/grpcpp/security/tls_certificate_provider.h \
@ -1170,6 +1173,44 @@ src/core/ext/filters/stateful_session/stateful_session_filter.cc \
src/core/ext/filters/stateful_session/stateful_session_filter.h \
src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc \
src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h \
src/core/ext/transport/binder/client/binder_connector.cc \
src/core/ext/transport/binder/client/binder_connector.h \
src/core/ext/transport/binder/client/channel_create.cc \
src/core/ext/transport/binder/client/channel_create_impl.cc \
src/core/ext/transport/binder/client/channel_create_impl.h \
src/core/ext/transport/binder/client/connection_id_generator.cc \
src/core/ext/transport/binder/client/connection_id_generator.h \
src/core/ext/transport/binder/client/endpoint_binder_pool.cc \
src/core/ext/transport/binder/client/endpoint_binder_pool.h \
src/core/ext/transport/binder/client/jni_utils.cc \
src/core/ext/transport/binder/client/jni_utils.h \
src/core/ext/transport/binder/client/security_policy_setting.cc \
src/core/ext/transport/binder/client/security_policy_setting.h \
src/core/ext/transport/binder/security_policy/binder_security_policy.cc \
src/core/ext/transport/binder/server/binder_server.cc \
src/core/ext/transport/binder/server/binder_server.h \
src/core/ext/transport/binder/server/binder_server_credentials.cc \
src/core/ext/transport/binder/transport/binder_stream.h \
src/core/ext/transport/binder/transport/binder_transport.cc \
src/core/ext/transport/binder/transport/binder_transport.h \
src/core/ext/transport/binder/utils/binder_auto_utils.h \
src/core/ext/transport/binder/utils/ndk_binder.cc \
src/core/ext/transport/binder/utils/ndk_binder.h \
src/core/ext/transport/binder/utils/transport_stream_receiver.h \
src/core/ext/transport/binder/utils/transport_stream_receiver_impl.cc \
src/core/ext/transport/binder/utils/transport_stream_receiver_impl.h \
src/core/ext/transport/binder/wire_format/binder.h \
src/core/ext/transport/binder/wire_format/binder_android.cc \
src/core/ext/transport/binder/wire_format/binder_android.h \
src/core/ext/transport/binder/wire_format/binder_constants.cc \
src/core/ext/transport/binder/wire_format/binder_constants.h \
src/core/ext/transport/binder/wire_format/transaction.cc \
src/core/ext/transport/binder/wire_format/transaction.h \
src/core/ext/transport/binder/wire_format/wire_reader.h \
src/core/ext/transport/binder/wire_format/wire_reader_impl.cc \
src/core/ext/transport/binder/wire_format/wire_reader_impl.h \
src/core/ext/transport/binder/wire_format/wire_writer.cc \
src/core/ext/transport/binder/wire_format/wire_writer.h \
src/core/ext/transport/chttp2/alpn/alpn.cc \
src/core/ext/transport/chttp2/alpn/alpn.h \
src/core/ext/transport/chttp2/client/chttp2_connector.cc \
@ -2668,6 +2709,7 @@ src/core/load_balancing/xds/xds_override_host.h \
src/core/load_balancing/xds/xds_wrr_locality.cc \
src/core/plugin_registry/grpc_plugin_registry.cc \
src/core/plugin_registry/grpc_plugin_registry_extra.cc \
src/core/resolver/binder/binder_resolver.cc \
src/core/resolver/dns/c_ares/dns_resolver_ares.cc \
src/core/resolver/dns/c_ares/dns_resolver_ares.h \
src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h \

@ -975,6 +975,7 @@ src/core/ext/filters/stateful_session/stateful_session_filter.h \
src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc \
src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h \
src/core/ext/transport/README.md \
src/core/ext/transport/binder/README.md \
src/core/ext/transport/chttp2/README.md \
src/core/ext/transport/chttp2/alpn/alpn.cc \
src/core/ext/transport/chttp2/alpn/alpn.h \
@ -2481,6 +2482,8 @@ src/core/load_balancing/xds/xds_wrr_locality.cc \
src/core/plugin_registry/grpc_plugin_registry.cc \
src/core/plugin_registry/grpc_plugin_registry_extra.cc \
src/core/resolver/README.md \
src/core/resolver/binder/README.md \
src/core/resolver/binder/binder_resolver.cc \
src/core/resolver/dns/c_ares/dns_resolver_ares.cc \
src/core/resolver/dns/c_ares/dns_resolver_ares.h \
src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h \

@ -0,0 +1,40 @@
#!/usr/bin/env bash
# Copyright 2021 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -ex
echo $ANDROID_HOME
echo $ANDROID_NDK_HOME
# Android platforms only works with Bazel >= 7.0
export OVERRIDE_BAZEL_VERSION=7.3.1
python3 tools/run_tests/python_utils/bazel_report_helper.py --report_path bazel_binder_example_app
bazel_binder_example_app/bazel_wrapper \
--bazelrc=tools/remote_build/include/test_locally_with_resultstore_results.bazelrc \
build \
--extra_toolchains=@androidndk//:all \
--android_platforms=//bazel/platforms/android:x86_64,//bazel/platforms/android:armeabi-v7a,//bazel/platforms/android:arm64-v8a \
//examples/android/binder/java/io/grpc/binder/cpp/exampleclient:app \
//examples/android/binder/java/io/grpc/binder/cpp/exampleserver:app
# Make sure the Java code that will be invoked by binder transport
# implementation builds
python3 tools/run_tests/python_utils/bazel_report_helper.py --report_path bazel_binder_connection_helper
bazel_binder_connection_helper/bazel_wrapper \
--bazelrc=tools/remote_build/include/test_locally_with_resultstore_results.bazelrc \
build \
--define=use_strict_warning=true \
@binder_transport_android_helper//io/grpc/binder/cpp:connection_helper

@ -1065,6 +1065,78 @@
],
"uses_polling": true
},
{
"args": [],
"benchmark": false,
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
"flaky": false,
"gtest": true,
"language": "c++",
"name": "binder_resolver_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
],
"uses_polling": true
},
{
"args": [],
"benchmark": false,
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
"flaky": false,
"gtest": true,
"language": "c++",
"name": "binder_server_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
],
"uses_polling": true
},
{
"args": [],
"benchmark": false,
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
"flaky": false,
"gtest": true,
"language": "c++",
"name": "binder_transport_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
],
"uses_polling": false
},
{
"args": [],
"benchmark": false,
@ -3123,6 +3195,30 @@
],
"uses_polling": false
},
{
"args": [],
"benchmark": false,
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
"flaky": false,
"gtest": true,
"language": "c++",
"name": "endpoint_binder_pool_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
],
"uses_polling": false
},
{
"args": [],
"benchmark": false,
@ -3479,6 +3575,30 @@
],
"uses_polling": true
},
{
"args": [],
"benchmark": false,
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
"flaky": false,
"gtest": true,
"language": "c++",
"name": "fake_binder_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
],
"uses_polling": false
},
{
"args": [],
"benchmark": false,
@ -11323,6 +11443,30 @@
],
"uses_polling": true
},
{
"args": [],
"benchmark": false,
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
"flaky": false,
"gtest": true,
"language": "c++",
"name": "transport_stream_receiver_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
],
"uses_polling": false
},
{
"args": [],
"benchmark": false,
@ -11749,6 +11893,54 @@
],
"uses_polling": false
},
{
"args": [],
"benchmark": false,
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
"flaky": false,
"gtest": true,
"language": "c++",
"name": "wire_reader_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
],
"uses_polling": false
},
{
"args": [],
"benchmark": false,
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
"flaky": false,
"gtest": true,
"language": "c++",
"name": "wire_writer_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
],
"uses_polling": false
},
{
"args": [],
"benchmark": false,

Loading…
Cancel
Save