Enable VNDK when version matches platform VNDK

When evaluating whether to build the VNDK for the multi-target
configurations, we construct the API level based on the VNDK
version. When the VNDK version is 'current', we replace the
version name with the platform SDK version e.g. 'UpsideDownCake'.

For architectures that currently have a MinApiArch of FutureApiLevel
(i.e. 'current'), comparing 'UpsideDownCake' with 'current' will
assume 'current' is at a higher API level and skip building the
VNDK.

Before perofrming the API level comparison, we check that the VNDK
version does not match the platform VNDK version. If true, it is
necessary to disable the VNDK when it does not meet the minimum API
level for the architecture. If false, we skip this check and allow
the VNDK to be enabled, as this implies we are targeting the 'current'
VNDK version and should include the target platform VNDK.

Test: m (soong test) & boot
Change-Id: Iacc33d2858fef670ddfdff5bbde9d32b084979c9
This commit is contained in:
Prashanth Swaminathan 2023-03-02 00:18:20 +00:00
parent a2e8ae1771
commit 0344c024fd

View file

@ -72,12 +72,14 @@ func apexVndkMutator(mctx android.TopDownMutatorContext) {
}
targets := mctx.MultiTargets()
if len(targets) > 0 && apiLevel.LessThan(cc.MinApiForArch(mctx, targets[0].Arch.ArchType)) {
// Disable VNDK apexes for VNDK versions less than the minimum supported API level for the primary
// architecture.
if len(targets) > 0 && apiLevel.LessThan(cc.MinApiForArch(mctx, targets[0].Arch.ArchType)) &&
vndkVersion != mctx.DeviceConfig().PlatformVndkVersion() {
// Disable VNDK APEXes for VNDK versions less than the minimum supported API
// level for the primary architecture. This validation is skipped if the VNDK
// version matches the platform VNDK version, which can occur when the device
// config targets the 'current' VNDK (see `vndkVersion`).
ab.Disable()
}
}
}