VNDK snapshot may provide LLNDK stub libraries
VNDK snapshots newer than v30 have LLNDK stub libraries. In that
case, the vendor variant for the BOARD_VNDK_VERSION must not be
generated from the LLNDK modules. They are already provided by the
VNDK snapshots.
Generate the vendor variant of the BOARD_VNDK_VERSION only if
BOARD_VNDK_VERSION has an integer value less than or equal to 30.
Bug: 187963715
Bug: 181815415
Test: m nothing
Change-Id: I31e90f4d7e7678c45558f6bf987f5582a4c34f78
diff --git a/cc/image.go b/cc/image.go
index 5d41717..47a424b 100644
--- a/cc/image.go
+++ b/cc/image.go
@@ -430,6 +430,16 @@
recoverySnapshotVersion := mctx.DeviceConfig().RecoverySnapshotVersion()
usingRecoverySnapshot := recoverySnapshotVersion != "current" &&
recoverySnapshotVersion != ""
+ needVndkVersionVendorVariantForLlndk := false
+ if boardVndkVersion != "" {
+ boardVndkApiLevel, err := android.ApiLevelFromUser(mctx, boardVndkVersion)
+ if err == nil && !boardVndkApiLevel.IsPreview() {
+ // VNDK snapshot newer than v30 has LLNDK stub libraries.
+ // Only the VNDK version less than or equal to v30 requires generating the vendor
+ // variant of the VNDK version from the source tree.
+ needVndkVersionVendorVariantForLlndk = boardVndkApiLevel.LessThanOrEqualTo(android.ApiLevelOrPanic(mctx, "30"))
+ }
+ }
if boardVndkVersion == "current" {
boardVndkVersion = platformVndkVersion
}
@@ -446,7 +456,9 @@
vendorVariants = append(vendorVariants, platformVndkVersion)
productVariants = append(productVariants, platformVndkVersion)
}
- if boardVndkVersion != "" {
+ // Generate vendor variants for boardVndkVersion only if the VNDK snapshot does not
+ // provide the LLNDK stub libraries.
+ if needVndkVersionVendorVariantForLlndk {
vendorVariants = append(vendorVariants, boardVndkVersion)
}
if productVndkVersion != "" {