Build VNDK with VNDK prebuilts without BOARD_VNDK_VERSION
Current VNDK prebuilts are disabled if BOARD_VNDK_VERSION is not set,
but VNDK prebuilts should be enabled even BOARD_VNDK_VERSION is not set
because VNDK APEXes should be available from VNDK deprecation. This
change removes some restrictions on VNDK prebuilts to enable those from
VNDK deprecation.
Bug: 316829758
Test: AOSP Cuttlefish build succeeded without BOARD_VNDK_VERSION
Change-Id: Id780811dab26f2125097c3efc5b2b4a59416b826
diff --git a/cc/vndk_prebuilt.go b/cc/vndk_prebuilt.go
index eb1790f..801e5f0 100644
--- a/cc/vndk_prebuilt.go
+++ b/cc/vndk_prebuilt.go
@@ -131,11 +131,14 @@
func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
flags Flags, deps PathDeps, objs Objects) android.Path {
- platformVndkApiLevel := android.ApiLevelOrPanic(ctx, ctx.DeviceConfig().PlatformVndkVersion())
- if platformVndkApiLevel.LessThanOrEqualTo(android.ApiLevelOrPanic(ctx, p.Version())) {
- // This prebuilt VNDK module is not required for the current build
- ctx.Module().HideFromMake()
- return nil
+ platformVndkVersion := ctx.DeviceConfig().PlatformVndkVersion()
+ if platformVndkVersion != "" {
+ platformVndkApiLevel := android.ApiLevelOrPanic(ctx, platformVndkVersion)
+ if platformVndkApiLevel.LessThanOrEqualTo(android.ApiLevelOrPanic(ctx, p.Version())) {
+ // This prebuilt VNDK module is not required for the current build
+ ctx.Module().HideFromMake()
+ return nil
+ }
}
if !p.MatchesWithDevice(ctx.DeviceConfig()) {
@@ -246,14 +249,6 @@
&prebuilt.properties,
)
- android.AddLoadHook(module, func(ctx android.LoadHookContext) {
- // empty BOARD_VNDK_VERSION implies that the device won't support
- // system only OTA. In this case, VNDK snapshots aren't needed.
- if ctx.DeviceConfig().VndkVersion() == "" {
- ctx.Module().Disable()
- }
- })
-
return module
}