Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a7cb4c6 authored by Justin Yun's avatar Justin Yun
Browse files

Use __ANDROID_VENDOR_API__ for vendor API surface

Build system defines __ANDROID_VENDOR_API__ for non-system modules.
Use this flag to provide vendor API surface for vendor or product
variant modules.

Bug: 368559337
Test: atest AImageReaderWindowTest
Change-Id: I7da3d4ca9f92255a426af8d66b4391f3c1426759
parent 7cc50a8c
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -25,15 +25,15 @@
    __attribute__((annotate("introduced_in_llndk=" #vendor_api_level)))
#endif

#if defined(__ANDROID_VNDK__)

#if defined(__ANDROID_VENDOR_API__)
// __ANDROID_VENDOR_API__ is defined only for vendor or product variant modules.
// Use this macro as an `if` statement to call an API that are available to both NDK and LLNDK.
// This returns true for the vendor modules if the vendor_api_level is less than or equal to the
// ro.board.api_level.
// This returns true for vendor or product modules if the vendor_api_level is less than or equal to
// the ro.board.api_level.
#define API_LEVEL_AT_LEAST(sdk_api_level, vendor_api_level) \
    constexpr(__ANDROID_VENDOR_API__ >= vendor_api_level)

#else  // __ANDROID_VNDK__
#else  // __ANDROID_VENDOR_API__

// For non-vendor modules, API_LEVEL_AT_LEAST is replaced with __builtin_available(sdk_api_level) to
// guard the API for __INTRODUCED_IN.
@@ -42,4 +42,4 @@
    (__builtin_available(android sdk_api_level, *))
#endif

#endif  // __ANDROID_VNDK__
#endif  // __ANDROID_VENDOR_API__