LLNDK version maps to NDK version
Instead of annotation duplicate LLNDK versions, use a corresponding
NDK version to find LLNDK symbols.
To generate LLNDK stubs, ndkstubgen sets `--llndk` argument with the
corresponding SDK version to its `--api` argument.
Bug: 361077712
Test: atest test_ndkstubgen
atest test_symbolfile
Change-Id: I64cd6eaeae4451326bf2e74b4d2639933f004393
diff --git a/cc/library.go b/cc/library.go
index 4ce506e..f4f4203 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -566,10 +566,16 @@
func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
if ctx.IsLlndk() {
- futureVendorApiLevel := android.ApiLevelOrPanic(ctx, "999999")
+ // Get the matching SDK version for the vendor API level.
+ version, err := android.GetSdkVersionForVendorApiLevel(ctx.Config().VendorApiLevel())
+ if err != nil {
+ panic(err)
+ }
+
+ // This is the vendor variant of an LLNDK library, build the LLNDK stubs.
nativeAbiResult := parseNativeAbiDefinition(ctx,
String(library.Properties.Llndk.Symbol_file),
- futureVendorApiLevel, "--llndk")
+ nativeClampedApiLevel(ctx, version), "--llndk")
objs := compileStubLibrary(ctx, flags, nativeAbiResult.stubSrc)
if !Bool(library.Properties.Llndk.Unversioned) {
library.versionScriptPath = android.OptionalPathForPath(