Give full access to native libs from java libs in the same partition
(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
11 files changed