diff options
author | 2024-05-17 05:24:28 +0200 | |
---|---|---|
committer | 2024-05-17 21:05:31 +0900 | |
commit | 84c0eddb305a3248046edd3f2f8bba03aab3efec (patch) | |
tree | 328b788d50a3f3043938a180912facc28bda0e57 | |
parent | 382f0db56cb95d0f1062ce46c73bc21705c87cef (diff) |
Update product treble check for VNDK deprecation
On devices which launched with an earlier version than R, if vndk is
deprecated, /product is no longer added to linker namespaces because
ro.product.vndk.version is gone.
The original change addressed an issue for devices running on U, but
on newer Android releases, /product is always treblelized.
Bug: 341228914
Test: Open any /product app that uses jni libs from /product on a
device with shipping api level <= 29, observe it no longer crashes
Change-Id: I4e4f8ae5fdff2298bfc85a5e7076f26dcc0f67d6
-rw-r--r-- | libnativeloader/public_libraries.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libnativeloader/public_libraries.cpp b/libnativeloader/public_libraries.cpp index c26b8f6bc4..53fcd2f35b 100644 --- a/libnativeloader/public_libraries.cpp +++ b/libnativeloader/public_libraries.cpp @@ -34,6 +34,7 @@ #include <log/log.h> #if defined(ART_TARGET_ANDROID) +#include <android-modules-utils/sdk_level.h> #include <android/sysprop/VndkProperties.sysprop.h> #endif @@ -426,12 +427,11 @@ const std::map<std::string, std::string>& apex_public_libraries() { bool is_product_treblelized() { #if defined(ART_TARGET_ANDROID) - // Product is not treblelized iff launching version is prior to R and - // ro.product.vndk.version is not defined - static bool product_treblelized = - !(android::base::GetIntProperty("ro.product.first_api_level", 0) < __ANDROID_API_R__ && - !android::sysprop::VndkProperties::product_vndk_version().has_value()); - return product_treblelized; + // Product is treblelized iff the sdk version is newer than U + // or launching version is R or newer or ro.product.vndk.version is defined + return android::modules::sdklevel::IsAtLeastV() || + android::base::GetIntProperty("ro.product.first_api_level", 0) >= __ANDROID_API_R__ || + android::sysprop::VndkProperties::product_vndk_version().has_value(); #else return false; #endif |