summaryrefslogtreecommitdiff
path: root/libnativeloader/library_namespaces_test.cpp
AgeCommit message (Collapse)Author
2024-06-19Recognise system/system_ext as a system image partition path. Martin Stjernholm
Also move the regex used for that next to the other partition regex'es for visibility, and add some unit tests. Test: atest libnativeloader_tests libnativeloader_e2e_tests on mokey_go32 Bug: 346515837 Change-Id: I30a85678e0d3c45645d6f089f5f1d92e1360e8bf
2024-04-24Clean up the test mocks. Martin Stjernholm
Split them up so that the API tests only have the JNI mock that they need, and the "platform" mock - which is nonfunctional there - is not present. Also a few other code cleanups. Test: atest libnativeloader_test \ art_libnativeloader_cts_test \ libnativeloader_lazy_test Bug: 335224367 Change-Id: Ifabc64db43e0346d5aefc9809266190690178ebf
2024-03-18Give full access to native libs from Java libs in the same partition Martin Stjernholm
(reland 2). For both packages and shared Java libs in system image partitions (system, product, vendor), load native libraries from the same partition by using the linker namespace for that partition ("default" or "system", "product", "sphal", respectively). This is only done for native libraries in the <partition root>/lib(64) directories when specified by an absolute path (i.e. use java.lang.System.load rather than loadLibrary). Otherwise it's looked up using the classloader namespace for the package, as before. Since only loads with absolute paths are affected, compat issues are unlikely. However to be on the safe side it's only enabled for SDK level 35 (VIC) and later (regardless of targetSdkVersion of the package, because the affected code is in system image partitions). This relands https://r.android.com/2933611 but keeps the vendor and product API domain checks unchanged in the CreateClassLoaderNamespace code paths (cf. b/326631342). Test: atest libnativeloader_e2e_tests \ libnativeloader_test libnativeloader_lazy_test Test: libnativeloader_e2e_tests on S, Sv2, T, and U platforms in CI Test: ImsServiceEntitlementUnitTests Bug: 237577392 Change-Id: I246101c1663d81089d9b4ae9450c28d564a7603a
2024-02-23Revert "Give full access to native libs from java libs in the sa..." Becky Siegel
Revert submission 2933611-libnativeloader-shared-syslibs Reason for revert: Fixing test breakage b/326622518, b/326631342 Reverted changes: /q/submissionid:2933611-libnativeloader-shared-syslibs Change-Id: I746478191c0e3a2d1a36d87e7a3db980de196420
2024-02-23Give full access to native libs from java libs in the same partition Martin Stjernholm
(reland). For both packages and shared java libs in system image partitions (system, product, vendor), load native libraries from the same partition by using the linker namespace for that partition ("default" or "system", "product", "sphal", respectively). This is only done for native libraries in the <partition root>/lib(64) directories when specified by an absolute path (i.e. use java.lang.System.load rather than loadLibrary). Otherwise it's looked up using the classloader namespace for the package, as before. Since only loads with absolute paths are affected, compat issues are unlikely. However to be on the safe side it's only enabled for SDK level 35 (VIC) and later (regardless of targetSdkVersion of the package, because the affected code is in system image partitions). This is based on a reland of commit 453b9fe909c22eb0f01b3072a5213dd46aed6f45, but with a different solution. It also extends the approach to work for vendor and product partitions. Test: atest libnativeloader_e2e_tests \ libnativeloader_test libnativeloader_lazy_test Test: libnativeloader_e2e_tests on S, Sv2, T, and U platforms in CI Bug: 237577392 Change-Id: If8b74503edfa9229b9eada73968b7d7b5c75ca10
2024-02-22Fix unit test to work on non-treblelized devices (i.e. sargo running S). Martin Stjernholm
Test: libnativeloader_test on sargo in CI Bug: 325619263 Change-Id: I6c712aeb64dca4fea5094348c72974c5e0ba1eb2
2024-02-20Separate handling of a single path and a list of paths when determining Martin Stjernholm
API domains. Becomes necessary in a later CL where it gets used on more or less arbitrary paths where we shouldn't treat colons specially. The old code crashed with a fatal if a list of paths had both vendor and product directories in it. This changes that to a more appropriate error that gets propagated to the java level and becomes an exception where the classloader is created. Test: atest libnativeloader_test Bug: 237577392 Change-Id: I783af87a03de18c65fadcd1fd5a71423ec0c786b