libbinder: export fewer symbols for bionic builds

https://r.android.com/3087749 added these new options. This commit
enables them for bionic builds. See that commit for details.

Bug: 338458975
Test: TH
Change-Id: Ib0a3bc28ab53931a673be5d85a3c760c318ead7e
diff --git a/libs/binder/Android.bp b/libs/binder/Android.bp
index f31f8d3..bd6a08e 100644
--- a/libs/binder/Android.bp
+++ b/libs/binder/Android.bp
@@ -268,6 +268,21 @@
         "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
         "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
     ],
+
+    target: {
+        bionic: {
+            // Hide symbols by default and set the BUILDING_LIBBINDER macro so that
+            // the code knows to export them.
+            //
+            // Only enabled on bionic builds, where RTTI is disabled, because
+            // it is failing to export required typeinfo symbols.
+            // TODO: b/341341056 - Find a solution for non-bionic builds.
+            cflags: [
+                "-fvisibility=hidden",
+                "-DBUILDING_LIBBINDER",
+            ],
+        },
+    },
 }
 
 cc_defaults {