Build 1.0_r1(from source)

android.view
Class ViewDebug

java.lang.Object
  extended by android.view.ViewDebug

public class ViewDebug
extends Object

Various debugging/tracing tools related to View and the view hierarchy.


Nested Class Summary
static interface ViewDebug.ExportedProperty
          This annotation can be used to mark fields and methods to be dumped by the view server.
static class ViewDebug.HierarchyTraceType
          Defines the type of hierarhcy trace to output to the hierarchy traces file.
static interface ViewDebug.IntToString
          Defines a mapping from an int value to a String.
static class ViewDebug.RecyclerTraceType
          Defines the type of recycler trace to output to the recycler traces file.
 
Field Summary
static boolean TRACE_HIERARCHY
          Enables or disables view hierarchy tracing.
static boolean TRACE_RECYCLER
          Enables or disables view recycler tracing.
 
Constructor Summary
ViewDebug()
           
 
Method Summary
(package private) static void dispatchCommand(View view, String command, String parameters, OutputStream clientStream)
           
static long getViewInstanceCount()
          Returns the number of instanciated Views.
static long getViewRootInstanceCount()
          Returns the number of instanciated ViewRoots.
static void startHierarchyTracing(String prefix, View view)
          Starts tracing the view hierarchy of the specified view.
static void startRecyclerTracing(String prefix, View view)
          Starts tracing the view recycler of the specified view.
static void stopHierarchyTracing()
          Stops the current view hierarchy tracing.
static void stopRecyclerTracing()
          Stops the current view recycer tracing.
static void trace(View view, ViewDebug.HierarchyTraceType type)
          Outputs a trace to the currently opened traces file.
static void trace(View view, ViewDebug.RecyclerTraceType type, int... parameters)
          Outputs a trace to the currently opened recycler traces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRACE_HIERARCHY

public static final boolean TRACE_HIERARCHY
Enables or disables view hierarchy tracing. Any invoker of trace(View, android.view.ViewDebug.HierarchyTraceType) should first check that this value is set to true as not to affect performance.

See Also:
Constant Field Values

TRACE_RECYCLER

public static final boolean TRACE_RECYCLER
Enables or disables view recycler tracing. Any invoker of trace(View, android.view.ViewDebug.RecyclerTraceType, int[]) should first check that this value is set to true as not to affect performance.

See Also:
Constant Field Values
Constructor Detail

ViewDebug

public ViewDebug()
Method Detail

getViewInstanceCount

public static long getViewInstanceCount()
Returns the number of instanciated Views.

Returns:
The number of Views instanciated in the current process.

getViewRootInstanceCount

public static long getViewRootInstanceCount()
Returns the number of instanciated ViewRoots.

Returns:
The number of ViewRoots instanciated in the current process.

trace

public static void trace(View view,
                         ViewDebug.RecyclerTraceType type,
                         int... parameters)
Outputs a trace to the currently opened recycler traces. The trace records the type of recycler action performed on the supplied view as well as a number of parameters.

Parameters:
view - the view to trace
type - the type of the trace
parameters - parameters depending on the type of the trace

startRecyclerTracing

public static void startRecyclerTracing(String prefix,
                                        View view)
Starts tracing the view recycler of the specified view. The trace is identified by a prefix, used to build the traces files names: /tmp/view-recycler/PREFIX.traces and /tmp/view-recycler/PREFIX.recycler. Only one view recycler can be traced at the same time. After calling this method, any other invocation will result in a IllegalStateException unless stopRecyclerTracing() is invoked before. Traces files are created only after stopRecyclerTracing() is invoked. This method will return immediately if TRACE_RECYCLER is false.

Parameters:
prefix - the traces files name prefix
view - the view whose recycler must be traced
See Also:
stopRecyclerTracing(), trace(View, android.view.ViewDebug.RecyclerTraceType, int[])

stopRecyclerTracing

public static void stopRecyclerTracing()
Stops the current view recycer tracing. Calling this method creates the file /tmp/view-recycler/PREFIX.traces containing all the traces (or method calls) relative to the specified view's recycler. Calling this method creates the file /tmp/view-recycler/PREFIX.recycler containing all of the views used by the recycler of the view supplied to startRecyclerTracing(String, View). This method will return immediately if TRACE_RECYCLER is false.

See Also:
startRecyclerTracing(String, View), trace(View, android.view.ViewDebug.RecyclerTraceType, int[])

trace

public static void trace(View view,
                         ViewDebug.HierarchyTraceType type)
Outputs a trace to the currently opened traces file. The trace contains the class name and instance's hashcode of the specified view as well as the supplied trace type.

Parameters:
view - the view to trace
type - the type of the trace

startHierarchyTracing

public static void startHierarchyTracing(String prefix,
                                         View view)
Starts tracing the view hierarchy of the specified view. The trace is identified by a prefix, used to build the traces files names: /tmp/view-hierarchy/PREFIX.traces and /tmp/view-hierarchy/PREFIX.tree. Only one view hierarchy can be traced at the same time. After calling this method, any other invocation will result in a IllegalStateException unless stopHierarchyTracing() is invoked before. Calling this method creates the file /tmp/view-hierarchy/PREFIX.traces containing all the traces (or method calls) relative to the specified view's hierarchy. This method will return immediately if TRACE_HIERARCHY is false.

Parameters:
prefix - the traces files name prefix
view - the view whose hierarchy must be traced
See Also:
stopHierarchyTracing(), trace(View, android.view.ViewDebug.HierarchyTraceType)

stopHierarchyTracing

public static void stopHierarchyTracing()
Stops the current view hierarchy tracing. This method closes the file /tmp/view-hierarchy/PREFIX.traces. Calling this method creates the file /tmp/view-hierarchy/PREFIX.tree containing the view hierarchy of the view supplied to startHierarchyTracing(String, View). This method will return immediately if TRACE_HIERARCHY is false.

See Also:
startHierarchyTracing(String, View), trace(View, android.view.ViewDebug.HierarchyTraceType)

dispatchCommand

static void dispatchCommand(View view,
                            String command,
                            String parameters,
                            OutputStream clientStream)
                     throws IOException
Throws:
IOException

Build 1.0_r1(from source)

Please submit a feedback, bug or feature