In run tests, do not rely on loading native libs in the ART namespace
with an allow_all_shared_libs fallback to system.

The system and com_android_art namespaces need to be properly
separated, but run tests have relied on loading test libraries through
either LD_LIBRARY_PATH or java.library.path without a clear separation.
That has worked through a combination of
ANDROID_ADDITIONAL_PUBLIC_LIBRARIES and fallback dlopen() calls that
used the ART namespace.

This change introduces a new directory
/data/nativetest(64)/com.android.art for test libraries that depend on
internal ART libraries. It's added with LD_LIBRARY_PATH to the default
namespace, which in the APEX linker config has full access to
com_android_art.

Normal JNI libraries that don't depend on ART internals stay in
/data/nativetest(64)/art/<arch>. There should be no overlap between the
two locations.

A new environment variable NATIVELOADER_DEFAULT_NAMESPACE_LIBS is
introduced to list the libraries added through LD_LIBRARY_PATH, so
libnativeloader can link to them from classloader namespaces and in the
fallback namespace when no classloader is specified.

Like ANDROID_ADDITIONAL_PUBLIC_LIBRARIES,
NATIVELOADER_DEFAULT_NAMESPACE_LIBS is only effective when
ro.debuggable is true.

A new cc_defaults "art_test_internal_library_defaults" is added to
Android.bp, to be used in libraries that should be installed in the new
com.android.art directory.

Some run tests that are special and need more treatment are disabled
for now, to be addressed in b/186654484.

Test: art/test/testrunner/testrunner.py --target --64 --optimizing
Test: art/test/testrunner/testrunner.py --target --32 --jit
Test: art/test/testrunner/testrunner.py --host --64 --optimizing
Bug: 130340935
Change-Id: Iec640d5e22b46af2c1a4d375ce3f06c57b1d224e
5 files changed