Snap for 10453563 from a89c064e14ba5aef2ea0b34992ee508d69ff9ffc to mainline-media-swcodec-release

Change-Id: Icffe0c02a170e06246eeff2ed80a0076d0c272d0
diff --git a/Android.bp b/Android.bp
index 5f16056..3eb4aa5 100644
--- a/Android.bp
+++ b/Android.bp
@@ -50,7 +50,7 @@
     vendor_available: true,
     apex_available: [
         "//apex_available:platform",
-        "com.android.bluetooth",
+        "com.android.btservices",
     ],
     shared_libs: [
         "libz",
@@ -167,6 +167,100 @@
     ],
 }
 
+genrule {
+    name: "reflection_proto_h",
+    tools: [
+        "aprotoc",
+        "protoc-gen-grpc-cpp-plugin",
+    ],
+    cmd: "$(location aprotoc) -Iexternal/grpc-grpc --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
+    srcs: [
+        "src/proto/grpc/reflection/v1alpha/reflection.proto",
+    ],
+    out: [
+        "src/proto/grpc/reflection/v1alpha/reflection.pb.h",
+        "src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h"
+    ],
+}
+
+genrule {
+    name: "reflection_proto_cc",
+    tools: [
+        "aprotoc",
+        "protoc-gen-grpc-cpp-plugin",
+    ],
+    cmd: "$(location aprotoc) -Iexternal/grpc-grpc --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
+    srcs: [
+        "src/proto/grpc/reflection/v1alpha/reflection.proto",
+    ],
+    out: [
+        "src/proto/grpc/reflection/v1alpha/reflection.pb.cc",
+        "src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc"
+    ],
+}
+
+cc_library_host_static {
+    name: "libgrpc++_reflection",
+    defaults: ["grpc_defaults"],
+    srcs: [
+        "src/cpp/ext/proto_server_reflection.cc",
+        "src/cpp/ext/proto_server_reflection_plugin.cc",
+    ],
+    generated_headers: [
+        "reflection_proto_h",
+    ],
+    export_generated_headers: [
+        "reflection_proto_h",
+    ],
+    generated_sources: [
+        "reflection_proto_cc",
+    ],
+    local_include_dirs: [
+        "include",
+    ],
+    static_libs: [
+        "libgrpc_base",
+        "libprotobuf-cpp-full",
+    ],
+}
+
+cc_library_host_static {
+    name: "grpc_cli_libs",
+    srcs: [
+        "test/cpp/util/cli_call.cc",
+        "test/cpp/util/cli_credentials.cc",
+        "test/cpp/util/grpc_tool.cc",
+        "test/cpp/util/proto_file_parser.cc",
+        "test/cpp/util/service_describer.cc",
+        "test/cpp/util/proto_reflection_descriptor_database.cc",
+        "test/cpp/util/test_config_cc.cc",
+    ],
+    local_include_dirs: [
+        "include"
+    ],
+    static_libs: [
+        "libgflags",
+        "libgrpc_base",
+    ],
+    generated_headers: [
+        "reflection_proto_h",
+    ],
+    export_generated_headers: [
+        "reflection_proto_h",
+    ],
+    generated_sources: [
+        "reflection_proto_cc",
+    ],
+    shared_libs: [
+        "libprotobuf-cpp-full",
+    ],
+    cflags: [
+        "-Wno-unused-parameter",
+    ],
+    export_include_dirs: ["."],
+    visibility: ["//device/google/cuttlefish:__subpackages__"],
+}
+
 cc_library_static {
     name: "libgrpc_workaround_cronet_compression_filter",
     defaults: ["grpc_defaults"],
@@ -1142,6 +1236,13 @@
     ],
 }
 
+cc_library_headers {
+    name: "libgrpc++_internal_headers",
+    defaults: ["grpc_defaults"],
+    export_include_dirs: ["."],
+    visibility: ["//visibility:public"],
+}
+
 // gRPC C++ library target with no encryption or authentication
 cc_library_shared {
     name: "libgrpc++_unsecure",
@@ -1162,7 +1263,6 @@
     ],
     export_include_dirs: [
         "include",
-        ".",
     ],
 }
 
@@ -1193,21 +1293,5 @@
     ],
     export_include_dirs: [
         "include",
-        ".",
     ],
 }
-
-// gRPC python library target
-python_library_host {
-    name: "py-grpc",
-    srcs: ["src/python/**/*.py"],
-    version: {
-        py2: {
-            enabled: true,
-        },
-        py3: {
-            enabled: true,
-        },
-    },
-    pkg_path: "grpc",
-}
diff --git a/include/grpcpp/impl/codegen/proto_utils.h b/include/grpcpp/impl/codegen/proto_utils.h
index d9db6de..043a49d 100644
--- a/include/grpcpp/impl/codegen/proto_utils.h
+++ b/include/grpcpp/impl/codegen/proto_utils.h
@@ -83,7 +83,7 @@
       return reader.status();
     }
     ::grpc::protobuf::io::CodedInputStream decoder(&reader);
-    decoder.SetTotalBytesLimit(INT_MAX, INT_MAX);
+    decoder.SetTotalBytesLimit(INT_MAX);
     if (!msg->ParseFromCodedStream(&decoder)) {
       result = Status(StatusCode::INTERNAL, msg->InitializationErrorString());
     }
diff --git a/test/core/util/Android.bp b/test/core/util/Android.bp
index fff362d..105a8e4 100644
--- a/test/core/util/Android.bp
+++ b/test/core/util/Android.bp
@@ -14,6 +14,9 @@
         "memory_counters.cc",
         "test_config.cc",
     ],
+    header_libs: [
+        "libgrpc++_internal_headers",
+    ],
     static_libs: [
         "gpr_base",
     ],
diff --git a/test/cpp/common/Android.bp b/test/cpp/common/Android.bp
index 2f6eb43..3c60a85 100644
--- a/test/cpp/common/Android.bp
+++ b/test/cpp/common/Android.bp
@@ -14,6 +14,9 @@
     srcs: [
         "alarm_test.cc",
     ],
+    header_libs: [
+        "libgrpc++_internal_headers",
+    ],
     static_libs: [
         "libgpr_test_util",
     ],
diff --git a/test/cpp/util/cli_credentials.cc b/test/cpp/util/cli_credentials.cc
index 1125b2d..91acc90 100644
--- a/test/cpp/util/cli_credentials.cc
+++ b/test/cpp/util/cli_credentials.cc
@@ -151,7 +151,7 @@
   if (IsAccessToken(FLAGS_call_creds)) {
     return grpc::AccessTokenCredentials(AccessToken(FLAGS_call_creds));
   }
-  if (FLAGS_call_creds.compare("none") != 0) {
+  if (FLAGS_call_creds.compare("none") == 0) {
     // Nothing to do; creds, if any, are baked into the channel.
     return std::shared_ptr<grpc::CallCredentials>();
   }