diff --git a/init/Android.bp b/init/Android.bp index a781d8bb9..a7278d608 100644 --- a/init/Android.bp +++ b/init/Android.bp @@ -196,6 +196,7 @@ libinit_cc_defaults { "libselinux", "libunwindstack", "libutils", + "libvendorsupport", ], header_libs: ["bionic_libc_platform_headers"], bootstrap: true, diff --git a/init/property_service.cpp b/init/property_service.cpp index e2cff957e..30ad80036 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -63,6 +63,7 @@ #include #include #include +#include #include "debug_ramdisk.h" #include "epoll.h" @@ -113,7 +114,6 @@ constexpr auto ID_PROP = "ro.build.id"; constexpr auto LEGACY_ID_PROP = "ro.build.legacy.id"; constexpr auto VBMETA_DIGEST_PROP = "ro.boot.vbmeta.digest"; constexpr auto DIGEST_SIZE_USED = 8; -constexpr auto MAX_VENDOR_API_LEVEL = 1000000; static bool persistent_properties_loaded = false; @@ -1085,25 +1085,13 @@ static void property_initialize_ro_cpu_abilist() { } } -static int vendor_api_level_of(int sdk_api_level) { - if (sdk_api_level < __ANDROID_API_V__) { - return sdk_api_level; - } - // In Android V, vendor API level started with version 202404. - // The calculation assumes that the SDK api level bumps once a year. - if (sdk_api_level < __ANDROID_API_FUTURE__) { - return 202404 + ((sdk_api_level - __ANDROID_API_V__) * 100); - } - return MAX_VENDOR_API_LEVEL; -} - static void property_initialize_ro_vendor_api_level() { // ro.vendor.api_level shows the api_level that the vendor images (vendor, odm, ...) are // required to support. constexpr auto VENDOR_API_LEVEL_PROP = "ro.vendor.api_level"; - auto vendor_api_level = GetIntProperty("ro.board.first_api_level", MAX_VENDOR_API_LEVEL); - if (vendor_api_level != MAX_VENDOR_API_LEVEL) { + auto vendor_api_level = GetIntProperty("ro.board.first_api_level", __ANDROID_VENDOR_API_MAX__); + if (vendor_api_level != __ANDROID_VENDOR_API_MAX__) { // Update the vendor_api_level with "ro.board.api_level" only if both "ro.board.api_level" // and "ro.board.first_api_level" are defined. vendor_api_level = GetIntProperty("ro.board.api_level", vendor_api_level); @@ -1118,6 +1106,12 @@ static void property_initialize_ro_vendor_api_level() { vendor_api_level = std::min(vendor_api_level_of(product_first_api_level), vendor_api_level); + if (vendor_api_level < 0) { + LOG(ERROR) << "Unexpected vendor api level for " << VENDOR_API_LEVEL_PROP << ". Check " + << "ro.product.first_api_level and ro.build.version.sdk."; + vendor_api_level = __ANDROID_VENDOR_API_MAX__; + } + std::string error; auto res = PropertySetNoSocket(VENDOR_API_LEVEL_PROP, std::to_string(vendor_api_level), &error); if (res != PROP_SUCCESS) { diff --git a/libvendorsupport/Android.bp b/libvendorsupport/Android.bp index 16a4c4c8a..b4457b181 100644 --- a/libvendorsupport/Android.bp +++ b/libvendorsupport/Android.bp @@ -19,6 +19,7 @@ package { cc_library { name: "libvendorsupport", native_bridge_supported: true, + recovery_available: true, llndk: { symbol_file: "libvendorsupport.map.txt", },