1 // Copyright (C) 2024 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #pragma once 16 17 #include <sys/cdefs.h> 18 19 __BEGIN_DECLS 20 21 #define __ANDROID_VENDOR_API_MAX__ 1000000 22 #define __INVALID_API_LEVEL -1 23 24 /** 25 * @brief Find corresponding vendor API level from an SDK API version. 26 * 27 * @details 28 * SDK API versions and vendor API levels are not compatible and not 29 * exchangeable. However, this function can be used to compare the two versions 30 * to know which one is newer than the other. 31 * 32 * @param sdkApiLevel The SDK version int. This must be less than 10000. 33 * @return The corresponding vendor API level of the SDK version. -1 if the SDK 34 * version is invalid or 10000. 35 */ 36 int AVendorSupport_getVendorApiLevelOf(int sdkApiLevel); 37 38 /** 39 * @brief Find corresponding SDK API version from a vendor API level. 40 * 41 * @param vendorApiLevel The vendor API level int. 42 * @return The corresponding SDK API version of the vendor API level. -1 if the 43 * vendor API level is invalid. 44 */ 45 int AVendorSupport_getSdkApiLevelOf(int vendorApiLevel); 46 47 #if !defined(__ANDROID_VENDOR__) 48 /** 49 * @brief Provide vendor API level to system modules. 50 * 51 * @details 52 * Before deprecating VNDK, system modules read ro.vndk.version to find the 53 * API level that vendor image had implemented. With the VNDK deprecation, this 54 * must be replaced with ro.board.api_level. However, there still are devices 55 * keeping old vendor partitions with the new system upgraded. In this case, the 56 * VNDK version can be used as before. 57 * This API is for platform only. 58 * 59 * @return ro.vndk.version if exist. Otherwise fallback to ro.board.api_level. 60 * 0 if none of these properties are found. This is unexpected, though. 61 */ 62 int AVendorSupport_getVendorApiLevel(); 63 #endif // __ANDROID_VENDOR__ 64 65 __END_DECLS 66