Add platform_apis property to APEX module type
The property is used to allow non-updatable APEXes to use platform APIs
(e.g. symbols marked as "# platform-only").
Bug: 191637950
Test: m com.android.virt com.android.compos
Merged-In: Id2410b4e38a78ec2146a42298840954381a7c472
Change-Id: Id2410b4e38a78ec2146a42298840954381a7c472
(cherry picked from commit fb63625a7f147735f97d5cc9eaabf3f93cf0d0a2)
diff --git a/cc/cc.go b/cc/cc.go
index e909347..fd4d89f 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -2904,11 +2904,11 @@
// of apex sdk enforcement below to choose right version.
useStubs = true
}
- } else if apexInfo.IsForPlatform() {
- // If not building for APEX, use stubs only when it is from
- // an APEX (and not from platform)
- // However, for host, ramdisk, vendor_ramdisk, recovery or bootstrap modules,
- // always link to non-stub variant
+ } else if apexInfo.IsForPlatform() || apexInfo.UsePlatformApis {
+ // If not building for APEX or the containing APEX allows the use of
+ // platform APIs, use stubs only when it is from an APEX (and not from
+ // platform) However, for host, ramdisk, vendor_ramdisk, recovery or
+ // bootstrap modules, always link to non-stub variant
useStubs = dep.(android.ApexModule).NotInPlatform() && !bootstrap
if useStubs {
// Another exception: if this module is a test for an APEX, then