Introduce BaseDexClassLoader.computeClassLoaderContextsNative
This will be used to compute the contexts that should be sent over to
the dex load reporter. See associated changes in libcore &
frameworks/base.
Motivation: At the moment of committing there are two classloader
context encoders- one in ART and one in the package manager. The
duplicate logic is susceptible to divergences. For example at the moment
if a package uses shared libraries and has secondary dex files then the
context encoded for secondary dex files will be incorrect[1]. In order to
eliminate this bug and future possible bugs lets centralize where all
classloader context computation is done.
[1]: The context will be incorrect because it doesn't take into account
the shared libraries that are loaded at runtime.
Test: m test-art-host-gtest-class_loader_context_test
Test: m test-art-host-gtest
Test: ./test/testrunner/testrunner.py --host -b
Test: Introduced a set of tests for the new API(s)
Test: See tests in associated libcore & framework/base commits
Bug: 148494302
Change-Id: Id39293a2e1d3d05194f2864f4febb3e652bce075
diff --git a/runtime/common_runtime_test.h b/runtime/common_runtime_test.h
index 2e9e078..7500515 100644
--- a/runtime/common_runtime_test.h
+++ b/runtime/common_runtime_test.h
@@ -152,9 +152,12 @@
jobject LoadDexInPathClassLoader(const std::string& dex_name,
jobject parent_loader,
jobject shared_libraries = nullptr);
+ jobject LoadDexInPathClassLoader(const std::vector<std::string>& dex_names,
+ jobject parent_loader,
+ jobject shared_libraries = nullptr);
jobject LoadDexInDelegateLastClassLoader(const std::string& dex_name, jobject parent_loader);
jobject LoadDexInInMemoryDexClassLoader(const std::string& dex_name, jobject parent_loader);
- jobject LoadDexInWellKnownClassLoader(const std::string& dex_name,
+ jobject LoadDexInWellKnownClassLoader(const std::vector<std::string>& dex_names,
jclass loader_class,
jobject parent_loader,
jobject shared_libraries = nullptr);