use_vndk_as_stable APEX shouldn't include VNDK lib

Even though a vendor APEX sets use_vndk_as_stable:true it was possible
to include a VNDK lib by directly depending on it with
native_shared_libs.

But it's contradictory to have a VNDK lib while declaring not to include
VNDK libs. It was missing since pruning dependencies on VNDK libs was
done only for transitive deps.

Added a check to reject this.

Bug: 216847402
Test: m nothing(running soong tests)
Change-Id: I8d79a434b1bfe8e563cf8968fa76830b0e582f66
This commit is contained in:
Jooyung Han
2022-02-04 11:54:50 +09:00
parent 99a81c8dfd
commit c5a967630e
2 changed files with 29 additions and 3 deletions

View File

@@ -888,9 +888,18 @@ func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) {
// APEX, but shared across APEXes via the VNDK APEX.
useVndk := a.SocSpecific() || a.DeviceSpecific() || (a.ProductSpecific() && mctx.Config().EnforceProductPartitionInterface())
excludeVndkLibs := useVndk && proptools.Bool(a.properties.Use_vndk_as_stable)
if !useVndk && proptools.Bool(a.properties.Use_vndk_as_stable) {
mctx.PropertyErrorf("use_vndk_as_stable", "not supported for system/system_ext APEXes")
return
if proptools.Bool(a.properties.Use_vndk_as_stable) {
if !useVndk {
mctx.PropertyErrorf("use_vndk_as_stable", "not supported for system/system_ext APEXes")
}
mctx.VisitDirectDepsWithTag(sharedLibTag, func(dep android.Module) {
if c, ok := dep.(*cc.Module); ok && c.IsVndk() {
mctx.PropertyErrorf("use_vndk_as_stable", "Trying to include a VNDK library(%s) while use_vndk_as_stable is true.", dep.Name())
}
})
if mctx.Failed() {
return
}
}
continueApexDepsWalk := func(child, parent android.Module) bool {