Package dalvik.system
Class VMStack
- java.lang.Object
-
- dalvik.system.VMStack
-
public final class VMStack extends Object
Provides a limited interface to the Dalvik VM stack. This class is mostly used for implementing security checks.
-
-
Constructor Summary
Constructors Constructor Description VMStack()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intfillStackTraceElements(Thread t, StackTraceElement[] stackTraceElements)Retrieves a partial stack trace from the specified thread into the provided array.static ClassLoadergetCallingClassLoader()Returns the defining class loader of the caller's caller.static ClassLoadergetClosestUserClassLoader()Returns the first ClassLoader on the call stack that isn't the bootstrap class loader.static Class<?>getStackClass1()Returns the class of the caller's caller.static Class<?>getStackClass2()Returns the class of the caller's caller's caller.static StackTraceElement[]getThreadStackTrace(Thread t)Retrieves the stack trace from the specified thread.
-
-
-
Method Detail
-
getCallingClassLoader
public static ClassLoader getCallingClassLoader()
Returns the defining class loader of the caller's caller.- Returns:
- the requested class loader, or
nullif this is the bootstrap class loader.
-
getStackClass1
public static Class<?> getStackClass1()
Returns the class of the caller's caller.- Returns:
- the requested class, or
null.
-
getStackClass2
public static Class<?> getStackClass2()
Returns the class of the caller's caller's caller.- Returns:
- the requested class, or
null.
-
getClosestUserClassLoader
public static ClassLoader getClosestUserClassLoader()
Returns the first ClassLoader on the call stack that isn't the bootstrap class loader.
-
getThreadStackTrace
public static StackTraceElement[] getThreadStackTrace(Thread t)
Retrieves the stack trace from the specified thread.- Parameters:
t- thread of interest- Returns:
- an array of stack trace elements, or null if the thread doesn't have a stack trace (e.g. because it exited)
-
fillStackTraceElements
public static int fillStackTraceElements(Thread t, StackTraceElement[] stackTraceElements)
Retrieves a partial stack trace from the specified thread into the provided array.- Parameters:
t- thread of intereststackTraceElements- preallocated array for use when only the top of stack is desired. Unused elements will be filled with null values.- Returns:
- the number of elements filled
-
-