diff options
author | 2021-06-20 17:54:38 +0900 | |
---|---|---|
committer | 2021-06-21 20:00:10 +0000 | |
commit | 180e1e70534d3db22571c428bdbaff16a4ed5db3 (patch) | |
tree | 3f68563630f93ec1aef4298da18b04ca4d73e5f9 /libnativeloader/library_namespaces.cpp | |
parent | 1ff9056b87705e251501ea4d19280a7e4fe2d009 (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
Change-Id: I3df47203d336036d0e015f9c5421b30a0377087f
Diffstat (limited to 'libnativeloader/library_namespaces.cpp')
-rw-r--r-- | libnativeloader/library_namespaces.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/libnativeloader/library_namespaces.cpp b/libnativeloader/library_namespaces.cpp index 2360819987..8b87338fba 100644 --- a/libnativeloader/library_namespaces.cpp +++ b/libnativeloader/library_namespaces.cpp @@ -344,15 +344,17 @@ Result<NativeLoaderNamespace*> LibraryNamespaces::Create(JNIEnv* env, uint32_t t } } - auto apex_ns_name = FindApexNamespaceName(dex_path); - if (apex_ns_name.ok()) { - const auto& jni_libs = apex_jni_libraries(*apex_ns_name); - if (jni_libs != "") { - auto apex_ns = NativeLoaderNamespace::GetExportedNamespace(*apex_ns_name, is_bridged); - if (apex_ns.ok()) { - linked = app_ns->Link(&apex_ns.value(), jni_libs); - if (!linked.ok()) { - return linked.error(); + for (const std::string& each_jar_path : android::base::Split(dex_path, ":")) { + auto apex_ns_name = FindApexNamespaceName(each_jar_path); + if (apex_ns_name.ok()) { + const auto& jni_libs = apex_jni_libraries(*apex_ns_name); + if (jni_libs != "") { + auto apex_ns = NativeLoaderNamespace::GetExportedNamespace(*apex_ns_name, is_bridged); + if (apex_ns.ok()) { + linked = app_ns->Link(&apex_ns.value(), jni_libs); + if (!linked.ok()) { + return linked.error(); + } } } } |