From c8c2953cffe8ff9d2204f4efdff9100eb9fa6df0 Mon Sep 17 00:00:00 2001 From: Kiyoung Kim Date: Fri, 22 Sep 2023 13:52:47 +0900 Subject: Use product vndk version to check if product vndk is deprecated There are some logic in libnativeloader to check if product is treblelized by checking ro.product.vndk.version. However, this property is no longer valid to check if product is treblelized, because of vndk deprecation. This makes libnativeloader to consider as product is not treblelized when the property is empty from the VNDK deprecation. This causes unexpected error from libnativeloader which allows product apps to use system / system_ext libraries when the product partition is VNDK deprecated. Product is force-treblelized from R, so it is safe to assume that product partition is always treblelized as long as the device is treblelized. This change removes existing check of ro.product.vndk.version, and use this check only to confirm if product VNDK is deprecated. Bug: 290159430 Test: Cuttlefish build and run succeeded Test: libnativeloader_e2e_tests passed Change-Id: Ieee3ff2dde4244e7c46420ad8dde5f8e5cf249e4 --- libnativeloader/library_namespaces.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'libnativeloader/library_namespaces.cpp') diff --git a/libnativeloader/library_namespaces.cpp b/libnativeloader/library_namespaces.cpp index 9aeebf38ad..dc92a88cb3 100644 --- a/libnativeloader/library_namespaces.cpp +++ b/libnativeloader/library_namespaces.cpp @@ -255,7 +255,7 @@ Result LibraryNamespaces::Create(JNIEnv* env, uint32_t t // Different name is useful for debugging namespace_name = kVendorClassloaderNamespaceName; - } else if (apk_origin == APK_ORIGIN_PRODUCT && is_product_vndk_version_defined()) { + } else if (apk_origin == APK_ORIGIN_PRODUCT) { unbundled_app_origin = APK_ORIGIN_PRODUCT; apk_origin_msg = "unbundled product apk"; @@ -405,11 +405,7 @@ Result LibraryNamespaces::Create(JNIEnv* env, uint32_t t auto product_libs = filter_public_libraries(target_sdk_version, uses_libraries, product_public_libraries()); if (!product_libs.empty()) { - auto target_ns = system_ns; - if (is_product_vndk_version_defined()) { - // If ro.product.vndk.version is defined, product namespace provides the product libraries. - target_ns = NativeLoaderNamespace::GetExportedNamespace(kProductNamespaceName, is_bridged); - } + auto target_ns = NativeLoaderNamespace::GetExportedNamespace(kProductNamespaceName, is_bridged); if (target_ns.ok()) { linked = app_ns->Link(&target_ns.value(), product_libs); if (!linked.ok()) { -- cgit v1.2.3-59-g8ed1b