Snap for 4625912 from 07b89888f5174bbb2af0365b5d4f392fb290eb54 to pi-release

Change-Id: I061fbc09bc63d4d30fb64cf55417aefe27f824d5
diff --git a/Android.bp b/Android.bp
index 0706d03..6f9f7cb 100644
--- a/Android.bp
+++ b/Android.bp
@@ -142,70 +142,75 @@
 
 // C++ full library
 // =======================================================
-protobuf_cc_full_src_files = [
-    "src/google/protobuf/any.pb.cc",
-    "src/google/protobuf/api.pb.cc",
-    "src/google/protobuf/stubs/mathlimits.cc",
-    "src/google/protobuf/any.cc",
-    "src/google/protobuf/descriptor.cc",
-    "src/google/protobuf/descriptor_database.cc",
-    "src/google/protobuf/descriptor.pb.cc",
-    "src/google/protobuf/duration.pb.cc",
-    "src/google/protobuf/dynamic_message.cc",
-    "src/google/protobuf/empty.pb.cc",
-    "src/google/protobuf/extension_set_heavy.cc",
-    "src/google/protobuf/field_mask.pb.cc",
-    "src/google/protobuf/generated_message_reflection.cc",
-    "src/google/protobuf/map_field.cc",
-    "src/google/protobuf/message.cc",
-    "src/google/protobuf/reflection_ops.cc",
-    "src/google/protobuf/service.cc",
-    "src/google/protobuf/source_context.pb.cc",
-    "src/google/protobuf/struct.pb.cc",
-    "src/google/protobuf/stubs/substitute.cc",
-    "src/google/protobuf/text_format.cc",
-    "src/google/protobuf/timestamp.pb.cc",
-    "src/google/protobuf/type.pb.cc",
-    "src/google/protobuf/unknown_field_set.cc",
-    "src/google/protobuf/wire_format.cc",
-    "src/google/protobuf/wrappers.pb.cc",
-    "src/google/protobuf/io/gzip_stream.cc",
-    "src/google/protobuf/io/printer.cc",
-    "src/google/protobuf/io/strtod.cc",
-    "src/google/protobuf/io/tokenizer.cc",
-    "src/google/protobuf/io/zero_copy_stream_impl.cc",
-    "src/google/protobuf/compiler/importer.cc",
-    "src/google/protobuf/compiler/parser.cc",
-    "src/google/protobuf/util/field_comparator.cc",
-    "src/google/protobuf/util/field_mask_util.cc",
-    "src/google/protobuf/util/internal/datapiece.cc",
-    "src/google/protobuf/util/internal/default_value_objectwriter.cc",
-    "src/google/protobuf/util/internal/error_listener.cc",
-    "src/google/protobuf/util/internal/field_mask_utility.cc",
-    "src/google/protobuf/util/internal/json_escaping.cc",
-    "src/google/protobuf/util/internal/json_objectwriter.cc",
-    "src/google/protobuf/util/internal/json_stream_parser.cc",
-    "src/google/protobuf/util/internal/object_writer.cc",
-    "src/google/protobuf/util/internal/protostream_objectsource.cc",
-    "src/google/protobuf/util/internal/protostream_objectwriter.cc",
-    "src/google/protobuf/util/internal/proto_writer.cc",
-    "src/google/protobuf/util/internal/type_info.cc",
-    "src/google/protobuf/util/internal/type_info_test_helper.cc",
-    "src/google/protobuf/util/internal/utility.cc",
-    "src/google/protobuf/util/json_util.cc",
-    "src/google/protobuf/util/message_differencer.cc",
-    "src/google/protobuf/util/time_util.cc",
-    "src/google/protobuf/util/type_resolver_util.cc",
-]
+cc_defaults {
+    name: "libprotobuf-cpp-full-defaults",
+    defaults: ["libprotobuf-cpp-lite-defaults"],
+
+    srcs: [
+        "src/google/protobuf/any.pb.cc",
+        "src/google/protobuf/api.pb.cc",
+        "src/google/protobuf/stubs/mathlimits.cc",
+        "src/google/protobuf/any.cc",
+        "src/google/protobuf/descriptor.cc",
+        "src/google/protobuf/descriptor_database.cc",
+        "src/google/protobuf/descriptor.pb.cc",
+        "src/google/protobuf/duration.pb.cc",
+        "src/google/protobuf/dynamic_message.cc",
+        "src/google/protobuf/empty.pb.cc",
+        "src/google/protobuf/extension_set_heavy.cc",
+        "src/google/protobuf/field_mask.pb.cc",
+        "src/google/protobuf/generated_message_reflection.cc",
+        "src/google/protobuf/map_field.cc",
+        "src/google/protobuf/message.cc",
+        "src/google/protobuf/reflection_ops.cc",
+        "src/google/protobuf/service.cc",
+        "src/google/protobuf/source_context.pb.cc",
+        "src/google/protobuf/struct.pb.cc",
+        "src/google/protobuf/stubs/substitute.cc",
+        "src/google/protobuf/text_format.cc",
+        "src/google/protobuf/timestamp.pb.cc",
+        "src/google/protobuf/type.pb.cc",
+        "src/google/protobuf/unknown_field_set.cc",
+        "src/google/protobuf/wire_format.cc",
+        "src/google/protobuf/wrappers.pb.cc",
+        "src/google/protobuf/io/gzip_stream.cc",
+        "src/google/protobuf/io/printer.cc",
+        "src/google/protobuf/io/strtod.cc",
+        "src/google/protobuf/io/tokenizer.cc",
+        "src/google/protobuf/io/zero_copy_stream_impl.cc",
+        "src/google/protobuf/compiler/importer.cc",
+        "src/google/protobuf/compiler/parser.cc",
+        "src/google/protobuf/util/field_comparator.cc",
+        "src/google/protobuf/util/field_mask_util.cc",
+        "src/google/protobuf/util/internal/datapiece.cc",
+        "src/google/protobuf/util/internal/default_value_objectwriter.cc",
+        "src/google/protobuf/util/internal/error_listener.cc",
+        "src/google/protobuf/util/internal/field_mask_utility.cc",
+        "src/google/protobuf/util/internal/json_escaping.cc",
+        "src/google/protobuf/util/internal/json_objectwriter.cc",
+        "src/google/protobuf/util/internal/json_stream_parser.cc",
+        "src/google/protobuf/util/internal/object_writer.cc",
+        "src/google/protobuf/util/internal/protostream_objectsource.cc",
+        "src/google/protobuf/util/internal/protostream_objectwriter.cc",
+        "src/google/protobuf/util/internal/proto_writer.cc",
+        "src/google/protobuf/util/internal/type_info.cc",
+        "src/google/protobuf/util/internal/type_info_test_helper.cc",
+        "src/google/protobuf/util/internal/utility.cc",
+        "src/google/protobuf/util/json_util.cc",
+        "src/google/protobuf/util/message_differencer.cc",
+        "src/google/protobuf/util/time_util.cc",
+        "src/google/protobuf/util/type_resolver_util.cc",
+    ],
+
+    cflags: ["-DHAVE_ZLIB=1"],
+    shared_libs: ["libz"],
+}
 
 // C++ full library for the NDK.
 // =======================================================
 cc_library_static {
     name: "libprotobuf-cpp-full-ndk",
-    defaults: ["libprotobuf-cpp-lite-defaults"],
-
-    srcs: protobuf_cc_full_src_files,
-    shared_libs: ["libz"],
+    defaults: ["libprotobuf-cpp-full-defaults"],
 
     cflags: ["-DGOOGLE_PROTOBUF_NO_RTTI"],
 
@@ -218,17 +223,14 @@
 // =======================================================
 cc_library_shared {
     name: "libprotobuf-cpp-full",
-    defaults: ["libprotobuf-cpp-lite-defaults"],
+    defaults: ["libprotobuf-cpp-full-defaults"],
     host_supported: true,
     vendor_available: true,
     vndk: {
         enabled: true,
     },
 
-    srcs: protobuf_cc_full_src_files,
-
     cflags: ["-DGOOGLE_PROTOBUF_NO_RTTI"],
-    shared_libs: ["libz"],
     target: {
         android: {
             shared_libs: ["liblog"],
@@ -240,13 +242,10 @@
 // =======================================================
 cc_library_shared {
     name: "libprotobuf-cpp-full-rtti",
-    defaults: ["libprotobuf-cpp-lite-defaults"],
+    defaults: ["libprotobuf-cpp-full-defaults"],
     vendor_available: true,
 
-    srcs: protobuf_cc_full_src_files,
-
     rtti: true,
-    shared_libs: ["libz"],
     target: {
         android: {
             shared_libs: ["liblog"],
@@ -258,9 +257,9 @@
 // =======================================================
 cc_library_host_shared {
     name: "libprotoc",
-    defaults: ["libprotobuf-cpp-lite-defaults"],
+    defaults: ["libprotobuf-cpp-full-defaults"],
 
-    srcs: protobuf_cc_full_src_files + [
+    srcs: [
         "src/google/protobuf/compiler/code_generator.cc",
         "src/google/protobuf/compiler/plugin.cc",
         "src/google/protobuf/compiler/plugin.pb.cc",
@@ -269,11 +268,12 @@
     local_include_dirs: [
         "config",
     ],
-    export_include_dirs: ["src", "config"],
+    export_include_dirs: [
+        "src",
+        "config",
+    ],
 
     rtti: true,
-
-    shared_libs: ["libz"],
 }
 
 // Android Protocol buffer compiler, aprotoc (host executable)
@@ -447,7 +447,9 @@
 
     static_libs: ["libz"],
 
-    cflags: IGNORED_WARNINGS,
+    cflags: IGNORED_WARNINGS + [
+        "-DHAVE_ZLIB=1",
+    ],
 
 }