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 fb63625a7f)
This commit is contained in:
Jiyong Park
2021-06-22 20:23:05 +09:00
parent 7d55b61783
commit 9477c26f6c
5 changed files with 140 additions and 27 deletions

View File

@@ -2904,11 +2904,11 @@ func ChooseStubOrImpl(ctx android.ModuleContext, dep android.Module) (SharedLibr
// 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