Set apex_available property

The marked library(ies) were available to the APEXes via the
hand-written whitelist in build/soong/apex/apex.go. Trying to remove the
whitelist by adding apex_available property to the Android.bp of the
libraries.

Bug: 150999716
Test: m
Test: python3 tools/install-build-deps
python3 tools/gen_android_bp

Change-Id: Ie198316a88355439f9201439026e19840e83c9c6
diff --git a/Android.bp b/Android.bp
index 7609f8e..7c2a1b8 100644
--- a/Android.bp
+++ b/Android.bp
@@ -613,6 +613,11 @@
     "-DGOOGLE_PROTOBUF_NO_RTTI",
     "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
   ],
+  apex_available: [
+    "//apex_available:platform",
+    "com.android.art.debug",
+    "com.android.art.release",
+  ],
 }
 
 // GN: //src/perfetto_cmd:perfetto
@@ -7490,6 +7495,11 @@
     "-DGOOGLE_PROTOBUF_NO_RTTI",
     "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
   ],
+  apex_available: [
+    "//apex_available:platform",
+    "com.android.art.debug",
+    "com.android.art.release",
+  ],
 }
 
 // GN: //:perfetto_unittests
diff --git a/tools/gen_android_bp b/tools/gen_android_bp
index 5567f04..099c384 100755
--- a/tools/gen_android_bp
+++ b/tools/gen_android_bp
@@ -178,6 +178,18 @@
     'trace_processor_shell': [
       ('stl', 'libc++_static'),
     ],
+    'libperfetto_client_experimental': [
+      ('apex_available', {
+        '//apex_available:platform',
+        'com.android.art.debug',
+        'com.android.art.release'}),
+    ],
+    'perfetto_trace_protos': [
+      ('apex_available', {
+        '//apex_available:platform',
+        'com.android.art.debug',
+        'com.android.art.release'}),
+    ],
 }
 
 
@@ -367,6 +379,7 @@
     self.dist = dict()
     self.strip = dict()
     self.data = set()
+    self.apex_available = set()
     # The genrule_XXX below are properties that must to be propagated back
     # on the module(s) that depend on the genrule.
     self.genrule_headers = set()
@@ -400,6 +413,7 @@
     self._output_field(output, 'tool_files')
     self._output_field(output, 'data')
     self._output_field(output, 'stl')
+    self._output_field(output, 'apex_available')
 
     target_out = []
     self._output_field(target_out, 'android')