summaryrefslogtreecommitdiffstats
path: root/dalvik
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2011-09-20 12:08:34 -0700
committerBrian Carlstrom <bdc@google.com>2013-06-05 14:05:25 -0700
commit552f220a1c5f481293bf47b21726635a0e5df601 (patch)
tree16c2be76d563904f48c7578df2beb967adf0e6f9 /dalvik
parent940f85738c2f1326317458f11f8d6b9880adfe42 (diff)
downloadlibcore-552f220a1c5f481293bf47b21726635a0e5df601.zip
libcore-552f220a1c5f481293bf47b21726635a0e5df601.tar.gz
libcore-552f220a1c5f481293bf47b21726635a0e5df601.tar.bz2
Change the VMStack interface used by serialization.
(cherry picked from commit 8b44bdb6063816eeb90da6b4f8aa3ed9f38fe140) Change-Id: I5da041caa3037a4093f05dec4e03aed4f466a21d
Diffstat (limited to 'dalvik')
-rw-r--r--dalvik/src/main/java/dalvik/system/VMStack.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/dalvik/src/main/java/dalvik/system/VMStack.java b/dalvik/src/main/java/dalvik/system/VMStack.java
index 9a2be23..bae1829 100644
--- a/dalvik/src/main/java/dalvik/system/VMStack.java
+++ b/dalvik/src/main/java/dalvik/system/VMStack.java
@@ -59,6 +59,22 @@ public final class VMStack {
native public static Class<?>[] getClasses(int maxDepth);
/**
+ * Returns the first ClassLoader on the call stack that isn't either of
+ * the passed-in ClassLoaders.
+ */
+ public static ClassLoader getClosestUserClassLoader(ClassLoader bootstrap,
+ ClassLoader system) {
+ Class<?>[] stackClasses = VMStack.getClasses(-1);
+ for (Class<?> stackClass : stackClasses) {
+ ClassLoader loader = stackClass.getClassLoader();
+ if (loader != null && loader != bootstrap && loader != system) {
+ return loader;
+ }
+ }
+ return null;
+ }
+
+ /**
* Retrieves the stack trace from the specified thread.
*
* @param t