Support InMemoryDexClassLoader in ClassLoaderContext
Add new class loader tag IMC to class loader context spec which
represents InMemoryDexClassLoader. A special case is required to not
attempt to open its dex files as the dex location does not correspond
to a real file path. This is achieved by setting load-attempted variable
to 'true' when encountering IMC whilst parsing a spec. Context with IMC
can still have opened dex files if it was created from an existing class
loader.
Bug: 72131483
Test: m test-art-host-gtest-class_loader_context_text
Change-Id: Ic64065819018a1e56dee0f65405d26beb8fd7bbd
diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc
index ca410d9..87c7ba6 100644
--- a/runtime/common_runtime_test.cc
+++ b/runtime/common_runtime_test.cc
@@ -331,6 +331,13 @@
parent_loader);
}
+jobject CommonRuntimeTestImpl::LoadDexInInMemoryDexClassLoader(const std::string& dex_name,
+ jobject parent_loader) {
+ return LoadDexInWellKnownClassLoader(dex_name,
+ WellKnownClasses::dalvik_system_InMemoryDexClassLoader,
+ parent_loader);
+}
+
void CommonRuntimeTestImpl::FillHeap(Thread* self,
ClassLinker* class_linker,
VariableSizedHandleScope* handle_scope) {