diff options
Diffstat (limited to 'rust/bindgen.go')
-rw-r--r-- | rust/bindgen.go | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/rust/bindgen.go b/rust/bindgen.go index 31aa13725..abb51814e 100644 --- a/rust/bindgen.go +++ b/rust/bindgen.go @@ -198,18 +198,20 @@ func (b *bindgenDecorator) GenerateSource(ctx ModuleContext, deps PathDeps) andr cflags = append(cflags, "-D__ANDROID_VNDK__") if ctx.RustModule().InVendor() { cflags = append(cflags, "-D__ANDROID_VENDOR__") - - vendorApiLevel := ctx.Config().VendorApiLevel() - if vendorApiLevel == "" { - // TODO(b/314036847): This is a fallback for UDC targets. - // This must be a build failure when UDC is no longer built - // from this source tree. - vendorApiLevel = ctx.Config().PlatformSdkVersion().String() - } - cflags = append(cflags, "-D__ANDROID_VENDOR_API__="+vendorApiLevel) } else if ctx.RustModule().InProduct() { cflags = append(cflags, "-D__ANDROID_PRODUCT__") } + + // Define __ANDROID_VENDOR_API__ for both product and vendor variants + // because they both use the same LLNDK libraries. + vendorApiLevel := ctx.Config().VendorApiLevel() + if vendorApiLevel == "" { + // TODO(b/314036847): This is a fallback for UDC targets. + // This must be a build failure when UDC is no longer built + // from this source tree. + vendorApiLevel = ctx.Config().PlatformSdkVersion().String() + } + cflags = append(cflags, "-D__ANDROID_VENDOR_API__="+vendorApiLevel) } if ctx.RustModule().InRecovery() { |