From 4058ba29b54c91f9d7ce7c33ee8b11360ab5be8d Mon Sep 17 00:00:00 2001 From: Justin Yun Date: Wed, 28 Feb 2024 21:03:41 +0900 Subject: [PATCH] Skip initializing ro.vendor.api_level if already defined Devices may predefine ro.vendor.api_level. Skip calculating the value if the ro.vendor.api_level is already defined. Bug: 326164316 Test: getprop ro.vendor.api_level Change-Id: Ic9fd2a0eef6ba9345f98a5cb1eb790080e19ca19 --- init/property_service.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/init/property_service.cpp b/init/property_service.cpp index bc4ef424b..9249d58db 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -1090,6 +1090,12 @@ static void property_initialize_ro_vendor_api_level() { // required to support. constexpr auto VENDOR_API_LEVEL_PROP = "ro.vendor.api_level"; + if (__system_property_find(VENDOR_API_LEVEL_PROP) != nullptr) { + // The device already have ro.vendor.api_level in its vendor/build.prop. + // Skip initializing the ro.vendor.api_level property. + return; + } + 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"