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
This commit is contained in:
Justin Yun
2021-05-18 23:10:00 +09:00
parent 6fae608181
commit dee806fd09
2 changed files with 94 additions and 55 deletions

View File

@@ -430,6 +430,16 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
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 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
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 != "" {