com.android.ddmlib
Class HandleViewDebug

java.lang.Object
  extended by com.android.ddmlib.jdwp.JdwpInterceptor
      extended by com.android.ddmlib.HandleViewDebug

public final class HandleViewDebug
extends JdwpInterceptor


Nested Class Summary
static class HandleViewDebug.ViewDumpHandler
           
 
Field Summary
static int CHUNK_FAIL
           
static int CHUNK_HEADER_LEN
           
static java.nio.ByteOrder CHUNK_ORDER
           
static int CHUNK_VUGL
          Enable/Disable tracing of OpenGL calls.
static int CHUNK_VULW
          List ViewRootImpl's of this process.
static int CHUNK_VUOP
          Generic View Operation, first parameter in the packet should be one of the VUOP_* constants below.
static int CHUNK_VURT
          Operation on view root, first parameter in packet should be one of VURT_* constants
static int DDMS_CMD
           
static int DDMS_CMD_SET
           
 
Method Summary
static void captureLayers(Client client, java.lang.String viewRoot, HandleViewDebug.ViewDumpHandler handler)
           
static void captureView(Client client, java.lang.String viewRoot, java.lang.String view, HandleViewDebug.ViewDumpHandler handler)
           
protected static Client checkDebuggerPortForAppName(Client client, java.lang.String appName)
          Check that the client is opened with the proper debugger port for the specified application name, and if not, reopen it.
 void clientDisconnected(Client client)
          Client has gone away.
 void clientReady(Client client)
          Client is ready.
static void dumpDisplayList(Client client, java.lang.String viewRoot, java.lang.String view)
           
static void dumpTheme(Client client, java.lang.String viewRoot, HandleViewDebug.ViewDumpHandler handler)
           
static void dumpViewHierarchy(Client client, java.lang.String viewRoot, boolean skipChildren, boolean includeProperties, HandleViewDebug.ViewDumpHandler handler)
           
static java.lang.String getString(java.nio.ByteBuffer buf, int len)
          Utility function to copy a String out of a ByteBuffer.
 void handleChunk(Client client, int type, java.nio.ByteBuffer data, boolean isReply, int msgId)
          Handle an incoming chunk.
protected  void handleUnknownChunk(Client client, int type, java.nio.ByteBuffer data, boolean isReply, int msgId)
          Handle chunks not recognized by handlers.
 JdwpPacket intercept(JdwpAgent agent, JdwpPacket packet)
           
static void invalidateView(Client client, java.lang.String viewRoot, java.lang.String view)
           
static void invokeMethod(Client client, java.lang.String viewRoot, java.lang.String view, java.lang.String method, java.lang.Object... args)
           
static void listViewRoots(Client client, HandleViewDebug.ViewDumpHandler replyHandler)
           
static void profileView(Client client, java.lang.String viewRoot, java.lang.String view, HandleViewDebug.ViewDumpHandler handler)
           
static void register(com.android.ddmlib.MonitorThread mt)
           
static void requestLayout(Client client, java.lang.String viewRoot, java.lang.String view)
           
static void sendStartGlTracing(Client client)
           
static void sendStopGlTracing(Client client)
           
static void setLayoutParameter(Client client, java.lang.String viewRoot, java.lang.String view, java.lang.String parameter, int value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHUNK_VUGL

public static final int CHUNK_VUGL
Enable/Disable tracing of OpenGL calls.


CHUNK_VULW

public static final int CHUNK_VULW
List ViewRootImpl's of this process.


CHUNK_VURT

public static final int CHUNK_VURT
Operation on view root, first parameter in packet should be one of VURT_* constants


CHUNK_VUOP

public static final int CHUNK_VUOP
Generic View Operation, first parameter in the packet should be one of the VUOP_* constants below.


CHUNK_HEADER_LEN

public static final int CHUNK_HEADER_LEN
See Also:
Constant Field Values

CHUNK_ORDER

public static final java.nio.ByteOrder CHUNK_ORDER

CHUNK_FAIL

public static final int CHUNK_FAIL

DDMS_CMD_SET

public static final int DDMS_CMD_SET
See Also:
Constant Field Values

DDMS_CMD

public static final int DDMS_CMD
See Also:
Constant Field Values
Method Detail

register

public static void register(com.android.ddmlib.MonitorThread mt)

clientReady

public void clientReady(Client client)
                 throws java.io.IOException
Client is ready. The monitor thread calls this method on all handlers when the client is determined to be DDM-aware (usually after receiving a HELO response.) The handler can use this opportunity to initialize client-side activity. Because there's a fair chance we'll want to send a message to the client, this method can throw an IOException.

Throws:
java.io.IOException

clientDisconnected

public void clientDisconnected(Client client)
Client has gone away. Can be used to clean up any resources associated with this client connection.


listViewRoots

public static void listViewRoots(Client client,
                                 HandleViewDebug.ViewDumpHandler replyHandler)
                          throws java.io.IOException
Throws:
java.io.IOException

dumpViewHierarchy

public static void dumpViewHierarchy(@NonNull
                                     Client client,
                                     @NonNull
                                     java.lang.String viewRoot,
                                     boolean skipChildren,
                                     boolean includeProperties,
                                     @NonNull
                                     HandleViewDebug.ViewDumpHandler handler)
                              throws java.io.IOException
Throws:
java.io.IOException

captureLayers

public static void captureLayers(@NonNull
                                 Client client,
                                 @NonNull
                                 java.lang.String viewRoot,
                                 @NonNull
                                 HandleViewDebug.ViewDumpHandler handler)
                          throws java.io.IOException
Throws:
java.io.IOException

profileView

public static void profileView(@NonNull
                               Client client,
                               @NonNull
                               java.lang.String viewRoot,
                               @NonNull
                               java.lang.String view,
                               @NonNull
                               HandleViewDebug.ViewDumpHandler handler)
                        throws java.io.IOException
Throws:
java.io.IOException

captureView

public static void captureView(@NonNull
                               Client client,
                               @NonNull
                               java.lang.String viewRoot,
                               @NonNull
                               java.lang.String view,
                               @NonNull
                               HandleViewDebug.ViewDumpHandler handler)
                        throws java.io.IOException
Throws:
java.io.IOException

invalidateView

public static void invalidateView(@NonNull
                                  Client client,
                                  @NonNull
                                  java.lang.String viewRoot,
                                  @NonNull
                                  java.lang.String view)
                           throws java.io.IOException
Throws:
java.io.IOException

requestLayout

public static void requestLayout(@NonNull
                                 Client client,
                                 @NonNull
                                 java.lang.String viewRoot,
                                 @NonNull
                                 java.lang.String view)
                          throws java.io.IOException
Throws:
java.io.IOException

dumpDisplayList

public static void dumpDisplayList(@NonNull
                                   Client client,
                                   @NonNull
                                   java.lang.String viewRoot,
                                   @NonNull
                                   java.lang.String view)
                            throws java.io.IOException
Throws:
java.io.IOException

dumpTheme

public static void dumpTheme(@NonNull
                             Client client,
                             @NonNull
                             java.lang.String viewRoot,
                             @NonNull
                             HandleViewDebug.ViewDumpHandler handler)
                      throws java.io.IOException
Throws:
java.io.IOException

invokeMethod

public static void invokeMethod(@NonNull
                                Client client,
                                @NonNull
                                java.lang.String viewRoot,
                                @NonNull
                                java.lang.String view,
                                @NonNull
                                java.lang.String method,
                                java.lang.Object... args)
                         throws java.io.IOException
Throws:
java.io.IOException

setLayoutParameter

public static void setLayoutParameter(@NonNull
                                      Client client,
                                      @NonNull
                                      java.lang.String viewRoot,
                                      @NonNull
                                      java.lang.String view,
                                      @NonNull
                                      java.lang.String parameter,
                                      int value)
                               throws java.io.IOException
Throws:
java.io.IOException

handleChunk

public void handleChunk(Client client,
                        int type,
                        java.nio.ByteBuffer data,
                        boolean isReply,
                        int msgId)
Handle an incoming chunk. The data, of chunk type "type", begins at the start of "data" and continues to data.limit(). If "isReply" is set, then "msgId" will be the ID of the request we sent to the client. Otherwise, it's the ID generated by the client for this event. Note that it's possible to receive chunks in reply packets for which we are not registered. The handler may not modify the contents of "data".


sendStartGlTracing

public static void sendStartGlTracing(Client client)
                               throws java.io.IOException
Throws:
java.io.IOException

sendStopGlTracing

public static void sendStopGlTracing(Client client)
                              throws java.io.IOException
Throws:
java.io.IOException

handleUnknownChunk

protected void handleUnknownChunk(Client client,
                                  int type,
                                  java.nio.ByteBuffer data,
                                  boolean isReply,
                                  int msgId)
Handle chunks not recognized by handlers. The handleChunk() method in sub-classes should call this if the chunk type isn't recognized.


getString

public static java.lang.String getString(java.nio.ByteBuffer buf,
                                         int len)
Utility function to copy a String out of a ByteBuffer.


checkDebuggerPortForAppName

protected static Client checkDebuggerPortForAppName(Client client,
                                                    java.lang.String appName)
Check that the client is opened with the proper debugger port for the specified application name, and if not, reopen it.

Parameters:
client -
appName -
Returns:

intercept

public JdwpPacket intercept(@NonNull
                            JdwpAgent agent,
                            @NonNull
                            JdwpPacket packet)
Specified by:
intercept in class JdwpInterceptor