diff options
| author | 2021-06-20 17:54:38 +0900 | |
|---|---|---|
| committer | 2021-06-22 00:56:43 +0000 | |
| commit | 8e4a3bc0cd6bf8af349b3abca4c06b540be1233a (patch) | |
| tree | 274665aa710468c8f900b827a223181acfc8ed28 /libnativeloader/native_loader_test.cpp | |
| parent | a58b38211b3a8a583a04098545be9143dc4db0db (diff) | |
Fix link apex for jni libs
When library_path is ":" splitted list of .jar files, we should iterate
over each .jar file path to link a proper APEX namespace for JNI lib.
Bug: 169826971
Test: libnativeloader_test
Test: move libicing to appsearch apex
Merged-In: I3df47203d336036d0e015f9c5421b30a0377087f
Change-Id: I3df47203d336036d0e015f9c5421b30a0377087f
(cherry picked from commit 1313b0cdb6ba0022dc672bb920933f1d09eb3169)
Diffstat (limited to 'libnativeloader/native_loader_test.cpp')
| -rw-r--r-- | libnativeloader/native_loader_test.cpp | 18 | 
1 files changed, 18 insertions, 0 deletions
| diff --git a/libnativeloader/native_loader_test.cpp b/libnativeloader/native_loader_test.cpp index 79e5070b01..c1dd4aaf1d 100644 --- a/libnativeloader/native_loader_test.cpp +++ b/libnativeloader/native_loader_test.cpp @@ -188,6 +188,7 @@ class NativeLoaderTest_Create : public NativeLoaderTest {    bool expected_link_with_platform_ns = true;    bool expected_link_with_art_ns = true;    bool expected_link_with_i18n_ns = true; +  bool expected_link_with_conscrypt_ns = false;    bool expected_link_with_sphal_ns = !vendor_public_libraries().empty();    bool expected_link_with_vndk_ns = false;    bool expected_link_with_vndk_product_ns = false; @@ -196,6 +197,7 @@ class NativeLoaderTest_Create : public NativeLoaderTest {    std::string expected_shared_libs_to_platform_ns = default_public_libraries();    std::string expected_shared_libs_to_art_ns = apex_public_libraries().at("com_android_art");    std::string expected_shared_libs_to_i18n_ns = apex_public_libraries().at("com_android_i18n"); +  std::string expected_shared_libs_to_conscrypt_ns = apex_jni_libraries("com_android_conscrypt");    std::string expected_shared_libs_to_sphal_ns = vendor_public_libraries();    std::string expected_shared_libs_to_vndk_ns = vndksp_libraries_vendor();    std::string expected_shared_libs_to_vndk_product_ns = vndksp_libraries_product(); @@ -255,6 +257,11 @@ class NativeLoaderTest_Create : public NativeLoaderTest {                                                StrEq(expected_shared_libs_to_neuralnetworks_ns)))            .WillOnce(Return(true));      } +    if (expected_link_with_conscrypt_ns) { +      EXPECT_CALL(*mock, mock_link_namespaces(Eq(IsBridged()), _, NsEq("com_android_conscrypt"), +                                              StrEq(expected_shared_libs_to_conscrypt_ns))) +          .WillOnce(Return(true)); +    }    }    void RunTest() { @@ -336,6 +343,17 @@ TEST_P(NativeLoaderTest_Create, BundledProductApp) {    RunTest();  } +TEST_P(NativeLoaderTest_Create, SystemServerWithApexJars) { +  dex_path = "/system/framework/services.jar:/apex/com.android.conscrypt/javalib/service-foo.jar"; +  is_shared = true; + +  expected_namespace_name = "classloader-namespace-shared"; +  expected_namespace_flags |= ANDROID_NAMESPACE_TYPE_SHARED; +  expected_link_with_conscrypt_ns = true; +  SetExpectations(); +  RunTest(); +} +  TEST_P(NativeLoaderTest_Create, UnbundledProductApp) {    dex_path = "/product/app/foo/foo.apk";    is_shared = false; |