From 760e495e79c03ce9c748a93ff42e6e3dd00bfc05 Mon Sep 17 00:00:00 2001 From: Kiyoung Kim Date: Wed, 18 Oct 2023 10:26:00 +0900 Subject: Check if product is treblelized Previous change on handling product partition was based on the assumption that all devices for mainline update would be product treblelized, but it was not true. There are some upgrade devices to S which is not product treblelized. This change checks if the device is treblelized with first api level and product vndk version. Bug: 305749591 Test: AOSP cuttlefish boot succeeded Test: libnativeloader_e2e_tests passed Change-Id: I46f9c0e253363b891bdc6b073df3cc14e9f7b5aa --- libnativeloader/library_namespaces.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libnativeloader/library_namespaces.cpp') diff --git a/libnativeloader/library_namespaces.cpp b/libnativeloader/library_namespaces.cpp index dc92a88cb3..1e29f4e457 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) { + } else if (apk_origin == APK_ORIGIN_PRODUCT && is_product_treblelized()) { unbundled_app_origin = APK_ORIGIN_PRODUCT; apk_origin_msg = "unbundled product apk"; @@ -405,7 +405,10 @@ 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 = NativeLoaderNamespace::GetExportedNamespace(kProductNamespaceName, is_bridged); + auto target_ns = system_ns; + if (is_product_treblelized()) { + 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