summaryrefslogtreecommitdiff
path: root/libnativeloader/public_libraries.cpp
AgeCommit message (Collapse)Author
2024-06-14Use C++20 `string{,_view}::{starts,ends}_with()`, part 2. Vladimir Marko
Replace uses of `android::base::{Starts,Ends}With()`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I80a0ca93f433464270989d248dd999e9366a1c17
2024-05-17Update product treble check for VNDK deprecation Tim Zimmermann
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
2024-05-15Fix performance-implicit-conversion-in-loop clang-tidy issues Stefano Cianciulli
Bug: 264654008 Test: m tidy-art Change-Id: I390ba6ed89534b43b6815445fae022af7952a69d
2024-02-28Avoid repeated logging of the file name when ReadConfig returns an Martin Stjernholm
error. https://r.android.com/2963904 made ReadConfig include the file name in the error if the file cannot be read, but some call sites added it as well. Make it consistently the responsibility of ReadConfig. Also shorten an error message where the path itself is good enough to identify the call site. Test: presubmits Bug: 325107109 Change-Id: I0c7d6c0ea3a7fb5d2ba1fa6aa25557080ac4d630
2024-02-15Refactorings to make more logic available at the top level in Martin Stjernholm
native_loader.cpp. - Make the code that determines the partition from the dex path available to code in native_loader.cpp, and rename it since it'll be applied to arbitrary paths, not just APK's. - Move the linker namespace constants to a header file. - Various other minor code cleanups. To prepare for a later CL that needs to access these things from OpenNativeLibrary. No functional changes. Test: atest libnativeloader_e2e_tests libnativeloader_test Bug: 237577392 Change-Id: Ifc762bf6d4664b2d477c4ed3af58f149fb4c1189
2024-02-14Improve an errno error message to show the file. Martin Stjernholm
Test: presubmits Bug: 325107109 Change-Id: I40ee8146f1cc36be9634ed1e3cf689ff6ce0e1f5
2023-10-19Check if product is treblelized Kiyoung Kim
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
2023-10-16Use product vndk version to check if product vndk is deprecated Kiyoung Kim
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
2023-09-04Use llndk.libraries.txt from system if VNDK is deprecated Kiyoung Kim
llndk.libraries.txt will be relocated into system when VNDK is deprecated. This change sets a new location to load llndk.libraries.txt when VNDK is deprecated. Bug: 290160925 Test: aosp_cf build and boot succeeded with llndk.libraries.txt in the system image Change-Id: Id1c6f3e0c68f5a805a9285611da759f1b9a26da4
2023-03-10Filter out renderscript libraries for riscv Prashanth Swaminathan
As a temporary measure while renderscript is still packaged into the generic system, filter out loading these libraries for riscv. Bug: 206676167 Test: Verified on aosp_cf_riscv64_slim that ART does not load libRS, even though it is present in public.libraries.txt. Change-Id: I433039688907cac75468ae8403d94aab7cc430a8
2023-01-07Correct an incomplete error message. Martin Stjernholm
Test: presubmits Change-Id: I1c270e1eda1cb26737ebef4c07c95e252b0d3875
2022-09-09Add debug logging of the initialisation of the various library lists. Martin Stjernholm
All these initialise static variables, so they log max once per process (or less, if they were initialised prefork in the zygote). Test: `adb logcat` and look for messages Bug: 137356719 Change-Id: Iad1afbb3b43be90ecb904ca044e25f4d057a1d59
2022-07-05Fix misc-unused-using-decl clang-tidy issues Stefano Cianciulli
Test: m tidy-art Bug: 213953102 Change-Id: Id2cec6926e863d96766a1d2d5ff3b5a9fef3bb03
2021-08-17Read public.libraries-<company>.txt from product/etc/ Justin Yun
Even in the case of unbundled product partition, extending the public libraries must follow the existing policy. Read public.libraries-<company>.txt from the product partition instead of public.libraries.txt in any cases. Bug: 186055799 Test: pm list libraries atest libnativeloader_test Change-Id: I1c9fd182fa902cf750a9644bf9a3c1ffcfa01340
2021-08-17Define product public libraries Justin Yun
When /product is unbundled from the /system, /product/etc/ may not have 'public.libraries-<companyname>.txt' to extend public libraries. Instead, /product/etc/public.library.txt can provide public libraries from /product. Bug: 186055799 Test: atest libnativeloader_test Change-Id: I8994649826657f59ac1dac655205b9704a2c67c9
2021-05-17Fix golem breakage. Nicolas Geoffray
Test: build-art-target-golem Change-Id: I262ebc20870debb357d12c87e944284f84191cbc
2021-05-13Drop ANDROID_ADDITIONAL_PUBLIC_LIBRARIES. Martin Stjernholm
It's not needed any more since libarttest(d).so is loaded from the ART linker namespace. Test: art/test/testrunner/testrunner.py --target --64 --optimizing Bug: 130340935 Bug: 167578583 Change-Id: I785133e921277cb25360856e9af20fa681b54a3b
2020-09-08clean up statsd public libraries Jooyung Han
JNI library(libstat_jni) from statsd apex is handled via the build system and linkerconfig. Bug: 150767721 Test: presubmit Test: atest libnativeloader_test Change-Id: Ia7527f053508d5992c3eef209f77260f0d210e81
2020-09-08libnativeloader: clean-up hard-coded public libs Jooyung Han
art, nn, i18n apexes provide some of libs listed in public.libraries.txt. The list of these apexes are now read from /linkerconfig/apex.libraries.config.txt generated by /system/bin/linkerconfig. Bug: 150767721 Test: cuttlefish boots Test: atest libnativeloader_test Change-Id: Ic603b42669dff89d5d3da2f6822312e827eddd86
2020-05-07"Move ICU from ART APEX to i18n APEX" Attempt 2 Victor Chang
The change was previously submitted in https://r.android.com/1283897 "Calling @IntraCoreApi from core-icu4j should not cause Core platform API violation" https://r.android.com/1299494 Bug: 138994281 Test: m checkbuild on aosp_x86-userdebug Test: device boots Change-Id: Idb3e2450fca5d8300aef353fc1e4e99e24f04372
2020-05-05Revert "Move ICU from ART APEX to i18n APEX" vichang
Revert "Move v8 and libpac into i18n APEX" Revert "Move core-icu4j into I18n APEX" Revert "Move ICU from ART APEX into i18n APEX" Revert "Move core-icu4j into i18n APEX" Revert "Move libpac into i18n APEX" Revert "Add shared library into i18n APEX and add the required s..." Revert "Make com_android_i18n namespace visible" Revert submission 1299494-i18nApex Reason for revert: Breaking aosp_x86-eng on aosp-master Reverted Changes: I30fc3735b:Move ICU from ART APEX to i18n APEX Icb7e98b5c:Calling @IntraCoreApi from core-icu4j should not c... Ic7de63fe3:Move core-icu4j into I18n APEX I65b97bdba:Make com_android_i18n namespace visible Ia4c83bc15:Move v8 and libpac into i18n APEX I10e6d4948:Move core-icu4j into i18n APEX I8d989cad7:Move ICU from ART APEX into i18n APEX I72216ca12:Move ICU into i18n APEX Ief9dace85:Add shared library into i18n APEX and add the requ... I7d97a10ba:Move libpac into i18n APEX I90fff9c55:Move ICU from ART APEX into i18n APEX Change-Id: I516a8d290e3a3cc2b45d71ba5400364b0478a57a
2020-05-05Move ICU from ART APEX to i18n APEX Victor Chang
It involves a change of boot class path to use core-icu4j from i18n APEX. Bug: 138994281 Test: device boots Test: m build-art-target-tests Test: CtsJniTestCases Test: atest libnativeloader_test Test: ./art/test/testrunner/run_build_test_target.py -j80 art-test Test: art/build/apex/runtests.sh Change-Id: I30fc3735be760cba48856cd102852d2a6c796374
2020-05-04Add libnativehelper.so to public libraries Orion Hodson
Exposes one copy libnativehelper to apps and everywhere else. Bug: 150252746 Bug: 151443957 Test: m & boot Test: art/tools/run-gtests.sh -j4 Test: art/test.py --target -r Change-Id: I20b3c5b722bb54a2d4aca74819bd38f801324452
2020-04-27Use ART_TARGET_ANDROID instead of __ANDROID__ Nicolas Geoffray
On golem, we build for ART_TARGET_LINUX, which doesn't have support for linkerconfig. Therefore, guard all linker namespace code on ART_TARGET_ANDROID instead of __ANDROID__ (which is unfortunately not under ART's control). Test: build for golem and run Bug: 154074847 Change-Id: I7a2b81918177704b42d8aafbd6d7e9d06d34e5f4
2020-04-15Replaced dangerous uses of sizeof() Chris Wailes
This patch replaces several uses of sizeof with calls to std::array's size method. Bug: 153655228 Test: Compiled with changed static asserts Test: Treehugger Change-Id: I4cf87f2d7fffe0d7c81e0652688bedd4d5c9c5c2
2020-03-24Skip reading VNDK libs for product if not available Justin Yun
If a device do not define "ro.product.vndk.version", we don't need to initialize the VNDK libraries for them. In that case, return emtpy string. Bug: 151992099 Test: atest libnativeloader_test Change-Id: Ic4d5e0e1162d367e919b5381e3a6c7d048a5e103
2020-03-04libnativeloader: Remove hard-coded cronet Jooyung Han
Because cronet apex sets its jni_libs, its classloader-namespace is linked automatically via jni.config.txt. Bug: 143733063 Bug: 146420818 Test: atest CronetApiTest Change-Id: I7ae0f7bc60f09e7e384abd1f0a1e4f8f90f64052
2020-03-04Loading JNI libraries in an APEX Jooyung Han
To load JNI libraries in an APEX, libnativeloader relies on jni.config.txt file which contains available JNI libraries for APEX namespaces: com_android_foo libfoo_jni.so:... com_android_bar libbar_jni.so:... This file is generated by linkerconfig. Bug: 143733063 Test: cuttlestone boots (For now, no behavioral changes because jni.config.txt is empty) Change-Id: I066de90a73875118be53972e50d076061922d762
2020-02-23Use {llndk,vndksp}.libraries.txt from VNDK APEX Jooyung Han
/system/etc/{llndk,vndksp}.libraries.txt files will be deprecated. These files can be read from VNDK APEX. Bug: 145184886 Test: build / boot Change-Id: If96fe7c75538e7fa94542e9b4d1d68a16cfa5f62
2020-02-21Use a different VNDK namespace for product apps Justin Yun
As product partition may have a different VNDK version than that of vendor partition, they may not share the same VNDK namespace for their apps. Define a new vndk_product namespace in the system section for product apps that uses ro.product.vndk.version. Bug: 149063221 Test: atest libnativeloader_test Change-Id: I1bb76617104a49b0d11af13d2f116959a18390a3
2020-02-16Add libstats_jni to linkerconfig/namespace Jeffrey Huang
As part of statsd becoming a Mainline module, moving libstats_jni to the apex requires adding it to the linker namespace here. Bug: 145922701 Test: m -j Change-Id: Ifcbea47cc36604e4a86df9af711d678b23012724
2020-02-13One more missing Result::ok() in native_loader_test.cpp Bernie Innocenti
Test: m checkbuild Change-Id: Ic7725afd2d0fd97ea0ced59e48455b92ae433047
2020-02-10Use product vndk version for product apps Justin Yun
ro.vndk.version is only for vendor modules. Product modules use different vndk version that is set in ro.product.vndk.version. Use product vndk version for creating namespaces for product apps. Bug: 148823287 Test: atest libnativeloader_test Change-Id: Iade4b3ca846f1e47e5138f2ceda81bf188276a91
2020-02-07Convert art/ to Result::ok() Bernie Innocenti
No functionality changes, this is a mechanical cleanup. Test: m Change-Id: I10030314ad8a06d49a63f1e2f3c5aa5b484e34b6
2020-02-06Remove extra using statements Tom Cherry
android::base::Errorf and android::base::ErrnoErrorf are now #define's instead of functions, so remove their using statements. Test: build Change-Id: Ifc2f5cf3ccf4de0b089cfe6b38e1f9724f5ff617
2020-01-07Make product libs available to unbundled product apks. Justin Yun
Unbundling product apps must be triggerred if the target is enforcing the product interfaces. The device must have ro.product.vndk.version property if its product interface is enforced. Unbundled product apps can use product libraries. Bug: 144534640 Bug: 127738095 Bug: 128557860 Test: check boot and basic features Change-Id: I32b2a1bd3e4f62b6acdbfab6bd277ec1132478a2
2019-12-17Add public lib of Cronet apex mainline Luke Huang
This is a workaround since apex module library path is not supported in jni Bug: 139397529 Bug: 145474221 Test: Build Test: manual test with Cronet Test: atest CtsJniTestCases Test: atest libnativeloader_test Change-Id: Ifd8aa85bd78e95131b2ce3eab0ad32c2bb19cee2
2019-12-17Read system_ext partition for partner defined public libraries. Justin Yun
Let partners define system libraries in system_ext for their apps. They can list the libraries in /system_ext/etc/public.libraries-<companyname>.txt for their apps to use. Bug: 134909174 Bug: 134359158 Test: build and boot Change-Id: I4edc6c19c4e23e2fec2d98aca7a1e4fd64fd5f2e
2019-10-11Move libnative{bridge,loader} to art/ Orion Hodson
This change moves system/core/libnative{bridge,loader} under art/. Bug: 137364733 Test: m Change-Id: I9be7333d00fcd3f36cd80520e50a30ea840187ad