diff options
author | 2019-12-23 06:59:06 -0800 | |
---|---|---|
committer | 2020-02-08 00:01:36 +0000 | |
commit | b682ea4d1f9f88ef41589007f385398033d61b65 (patch) | |
tree | b843077f05e2fe37ce5f566dfc823552f289f562 /runtime/class_loader_utils.h | |
parent | 77aa6807053a830fe5c951c7cb700813d7e2e27b (diff) |
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
Diffstat (limited to 'runtime/class_loader_utils.h')
-rw-r--r-- | runtime/class_loader_utils.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/class_loader_utils.h b/runtime/class_loader_utils.h index 1c353604fa..934c92b630 100644 --- a/runtime/class_loader_utils.h +++ b/runtime/class_loader_utils.h @@ -30,6 +30,14 @@ namespace art { +// Returns true if the given class loader derives from BaseDexClassLoader. +inline bool IsInstanceOfBaseDexClassLoader(ScopedObjectAccessAlreadyRunnable& soa, + Handle<mirror::ClassLoader> class_loader) + REQUIRES_SHARED(Locks::mutator_lock_) { + return class_loader->InstanceOf( + soa.Decode<mirror::Class>(WellKnownClasses::dalvik_system_BaseDexClassLoader)); +} + // Returns true if the given class loader is either a PathClassLoader or a DexClassLoader. // (they both have the same behaviour with respect to class lookup order) inline bool IsPathOrDexClassLoader(ScopedObjectAccessAlreadyRunnable& soa, |