public final class

VMStack

extends Object
java.lang.Object
   ↳ dalvik.system.VMStack

This class is deprecated.
this is an internal Dalvik class that is not appropriate for general use. It will be removed from the public API in a future release.

Class Overview

Provides a limited interface to the Dalvik VM stack. This class is mostly used for implementing security checks.

Summary

Public Constructors
VMStack()
Public Methods
static ClassLoader getCallingClassLoader()
Returns the defining class loader of the caller's caller.
static ClassLoader getCallingClassLoader2()
Returns the defining class loader of the caller's caller's caller.
static Class[]<?> getClasses(int maxDepth, boolean stopAtPrivileged)
Creates an array of classes from the methods at the top of the stack.
static StackTraceElement[] getThreadStackTrace(Thread t)
Retrieves the stack trace from the specified thread.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public VMStack ()

Since: API Level 1

Public Methods

public static ClassLoader getCallingClassLoader ()

Since: API Level 1

Returns the defining class loader of the caller's caller.

Returns
  • the requested class loader, or null if this is the bootstrap class loader.

public static ClassLoader getCallingClassLoader2 ()

Since: API Level 1

Returns the defining class loader of the caller's caller's caller.

Returns
  • the requested class loader, or null if this is the bootstrap class loader.

public static Class[]<?> getClasses (int maxDepth, boolean stopAtPrivileged)

Since: API Level 1

Creates an array of classes from the methods at the top of the stack. We continue until we reach the bottom of the stack or exceed the specified maximum depth. If stopAtPrivileged is set, the last element of the array will be the caller of the most-recent privileged method.

The topmost stack frame (this method) and the one above that (the caller) are excluded from the array. Frames with java.lang.reflect classes are skipped over.

The classes in the array are the defining classes of the methods.

This is expected to be identical to Harmony's VMStack.getClasses.

Parameters
maxDepth maximum number of classes to return, or -1 for all
stopAtPrivileged stop when a privileged frame is reached
Returns
  • an array with classes for the most-recent methods on the stack

public static StackTraceElement[] getThreadStackTrace (Thread t)

Since: API Level 1

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)