Fix PDK build

This commit disables "perfetto", "perfetto_integrationtests", and
"perfetto_unittests" in PDK builds because they depend on "libandroid"
or "libservices" which are not in PDK builds as well.

Test: Build a target (described in http://b/72961456) with
`platform.zip` built from master FSK source tree.

Bug: 72961456
Change-Id: Id754c322fefa75d37c5acc55ef52b0efeb4f6e8a
diff --git a/Android.bp b/Android.bp
index 902f142..e4e538a 100644
--- a/Android.bp
+++ b/Android.bp
@@ -156,6 +156,11 @@
     "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
     "-DPERFETTO_BUILD_WITH_ANDROID",
   ],
+  product_variables: {
+    pdk: {
+      enabled: false,
+    },
+  },
 }
 
 cc_defaults {
@@ -256,6 +261,11 @@
     "-DGOOGLE_PROTOBUF_NO_RTTI",
     "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
   ],
+  product_variables: {
+    pdk: {
+      enabled: false,
+    },
+  },
 }
 
 // GN target: //protos/perfetto/config:config_gen
@@ -1890,6 +1900,11 @@
     "-DGOOGLE_PROTOBUF_NO_RTTI",
     "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
   ],
+  product_variables: {
+    pdk: {
+      enabled: false,
+    },
+  },
 }
 
 // GN target: //:traced
diff --git a/tools/gen_android_bp b/tools/gen_android_bp
index 8cb7e39..a7dafc5 100755
--- a/tools/gen_android_bp
+++ b/tools/gen_android_bp
@@ -78,6 +78,12 @@
 # Compiler defines which are passed through to the blueprint.
 define_whitelist = r'^GOOGLE_PROTO.*$'
 
+# Shared libraries which are not in PDK.
+library_not_in_pdk = {
+    'libandroid',
+    'libservices',
+}
+
 
 def enable_gmock(module):
     module.static_libs.append('libgmock')
@@ -178,6 +184,12 @@
         self._output_field(output, 'defaults')
         self._output_field(output, 'cflags')
         self._output_field(output, 'local_include_dirs')
+        if any(name in library_not_in_pdk for name in self.shared_libs):
+            output.append('  product_variables: {')
+            output.append('    pdk: {')
+            output.append('      enabled: false,')
+            output.append('    },')
+            output.append('  },')
         output.append('}')
         output.append('')
 
@@ -186,7 +198,7 @@
         if not value:
             return
         if isinstance(value, set):
-          value = sorted(value)
+            value = sorted(value)
         if isinstance(value, list):
             output.append('  %s: [' % name)
             for item in sorted(value) if sort else value: