Merge "libbinder: export fewer symbols for non-vendor builds" into main am: 9a12e1d78a

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/3151657

Change-Id: I03b00963534bf5b6593bb682053ef03fec5cbde5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libs/binder/Android.bp b/libs/binder/Android.bp
index 1abde5c..80720b0 100644
--- a/libs/binder/Android.bp
+++ b/libs/binder/Android.bp
@@ -267,7 +267,20 @@
         "-Wunused-const-variable",
         "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
         "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
+        // Hide symbols by default and set the BUILDING_LIBBINDER macro so that
+        // the code knows to export them.
+        "-fvisibility=hidden",
+        "-DBUILDING_LIBBINDER",
     ],
+
+    target: {
+        vendor: {
+            // Trimming the exported symbols reveals a bug in vendor code, so
+            // disable it for the vendor variant for now. http://b/349657329
+            // TODO: Fix the issue and remove this override.
+            cflags: ["-fvisibility=default"],
+        },
+    },
 }
 
 cc_defaults {