com.android.ddmlib
Class Client

java.lang.Object
  extended by com.android.ddmlib.Client

public class Client
extends Object

This represents a single client, usually a DAlvik VM process.

This class gives access to basic client information, as well as methods to perform actions on the client.

More detailed information, usually updated in real time, can be access through the ClientData class. Each Client object has its own ClientData accessed through getClientData().


Field Summary
static int CHANGE_DEBUGGER_STATUS
          Client change bit mask: debugger status change
static int CHANGE_HEAP_ALLOCATION_STATUS
          Client change bit mask: allocation information updated
static int CHANGE_HEAP_ALLOCATIONS
          Client change bit mask: allocation information updated
static int CHANGE_HEAP_DATA
          Client change bit mask: head data updated
static int CHANGE_HEAP_MODE
          Client change bit mask: heap update flag change
static int CHANGE_INFO
          Client change bit mask: combination of CHANGE_NAME, CHANGE_DEBUGGER_STATUS, and CHANGE_PORT.
static int CHANGE_METHOD_PROFILING_STATUS
          Client change bit mask: allocation information updated
static int CHANGE_NAME
          Client change bit mask: application name change
static int CHANGE_NATIVE_HEAP_DATA
          Client change bit mask: native heap data updated
static int CHANGE_PORT
          Client change bit mask: debugger port change
static int CHANGE_THREAD_DATA
          Client change bit mask: thread data updated
static int CHANGE_THREAD_MODE
          Client change bit mask: thread update flag change
static int CHANGE_THREAD_STACKTRACE
          Client change bit mask: thread stack trace updated
 
Method Summary
 void dumpHprof()
          Makes the VM dump an HPROF file
 void enableAllocationTracker(boolean enable)
          Enables or disables the Allocation tracker for this client.
 void executeGarbageCollector()
          Forces the client to execute its garbage collector.
 ClientData getClientData()
          Returns the ClientData object containing this client information.
 int getDebuggerListenPort()
          Returns the debugger port for this client.
 IDevice getDevice()
          Returns the IDevice on which this Client is running.
 boolean isDdmAware()
          Returns true if the client VM is DDM-aware.
 boolean isDebuggerAttached()
          Returns true if a debugger is currently attached to the client.
 boolean isHeapUpdateEnabled()
          Returns whether the heap update is enabled.
 boolean isSelectedClient()
          Returns whether this client is the current selected client, accepting debugger connection on the "selected debugger port".
 boolean isThreadUpdateEnabled()
          Returns whether the thread update is enabled.
 boolean isValid()
          Returns whether this Client has a valid connection to the application VM.
 void kill()
          Sends a kill message to the VM.
 void requestAllocationDetails()
          Sends a request to the VM to send the information about all the allocations that have happened since the call to enableAllocationTracker(boolean) with enable set to null.
 void requestAllocationStatus()
          Sends a request to the VM to send the enable status of the allocation tracking.
 void requestMethodProfilingStatus()
          Sends a request to the VM to send the enable status of the method profiling.
 boolean requestNativeHeapInformation()
          Sends a native heap update request.
 void requestThreadStackTrace(int threadId)
          Sends a thread stack trace update request.
 void requestThreadUpdate()
          Sends a thread update request.
 void setAsSelectedClient()
          Sets the client to accept debugger connection on the "selected debugger port".
 void setHeapUpdateEnabled(boolean enabled)
          Enables or disables the heap update.
 void setThreadUpdateEnabled(boolean enabled)
          Enables or disables the thread update.
 void toggleMethodProfiling()
           
 String toString()
          Returns a string representation of the Client object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CHANGE_NAME

public static final int CHANGE_NAME
Client change bit mask: application name change

See Also:
Constant Field Values

CHANGE_DEBUGGER_STATUS

public static final int CHANGE_DEBUGGER_STATUS
Client change bit mask: debugger status change

See Also:
Constant Field Values

CHANGE_PORT

public static final int CHANGE_PORT
Client change bit mask: debugger port change

See Also:
Constant Field Values

CHANGE_THREAD_MODE

public static final int CHANGE_THREAD_MODE
Client change bit mask: thread update flag change

See Also:
Constant Field Values

CHANGE_THREAD_DATA

public static final int CHANGE_THREAD_DATA
Client change bit mask: thread data updated

See Also:
Constant Field Values

CHANGE_HEAP_MODE

public static final int CHANGE_HEAP_MODE
Client change bit mask: heap update flag change

See Also:
Constant Field Values

CHANGE_HEAP_DATA

public static final int CHANGE_HEAP_DATA
Client change bit mask: head data updated

See Also:
Constant Field Values

CHANGE_NATIVE_HEAP_DATA

public static final int CHANGE_NATIVE_HEAP_DATA
Client change bit mask: native heap data updated

See Also:
Constant Field Values

CHANGE_THREAD_STACKTRACE

public static final int CHANGE_THREAD_STACKTRACE
Client change bit mask: thread stack trace updated

See Also:
Constant Field Values

CHANGE_HEAP_ALLOCATIONS

public static final int CHANGE_HEAP_ALLOCATIONS
Client change bit mask: allocation information updated

See Also:
Constant Field Values

CHANGE_HEAP_ALLOCATION_STATUS

public static final int CHANGE_HEAP_ALLOCATION_STATUS
Client change bit mask: allocation information updated

See Also:
Constant Field Values

CHANGE_METHOD_PROFILING_STATUS

public static final int CHANGE_METHOD_PROFILING_STATUS
Client change bit mask: allocation information updated

See Also:
Constant Field Values

CHANGE_INFO

public static final int CHANGE_INFO
Client change bit mask: combination of CHANGE_NAME, CHANGE_DEBUGGER_STATUS, and CHANGE_PORT.

See Also:
Constant Field Values
Method Detail

toString

public String toString()
Returns a string representation of the Client object.

Overrides:
toString in class Object

getDevice

public IDevice getDevice()
Returns the IDevice on which this Client is running.


getDebuggerListenPort

public int getDebuggerListenPort()
Returns the debugger port for this client.


isDdmAware

public boolean isDdmAware()
Returns true if the client VM is DDM-aware. Calling here is only allowed after the connection has been established.


isDebuggerAttached

public boolean isDebuggerAttached()
Returns true if a debugger is currently attached to the client.


getClientData

public ClientData getClientData()
Returns the ClientData object containing this client information.


executeGarbageCollector

public void executeGarbageCollector()
Forces the client to execute its garbage collector.


dumpHprof

public void dumpHprof()
Makes the VM dump an HPROF file


toggleMethodProfiling

public void toggleMethodProfiling()

requestMethodProfilingStatus

public void requestMethodProfilingStatus()
Sends a request to the VM to send the enable status of the method profiling. This is asynchronous.

The allocation status can be accessed by ClientData.getAllocationStatus(). The notification that the new status is available will be received through AndroidDebugBridge.IClientChangeListener.clientChanged(Client, int) with a changeMask containing the mask CHANGE_HEAP_ALLOCATION_STATUS.


setThreadUpdateEnabled

public void setThreadUpdateEnabled(boolean enabled)
Enables or disables the thread update.

If true the VM will be able to send thread information. Thread information must be requested with requestThreadUpdate().

Parameters:
enabled - the enable flag.

isThreadUpdateEnabled

public boolean isThreadUpdateEnabled()
Returns whether the thread update is enabled.


requestThreadUpdate

public void requestThreadUpdate()
Sends a thread update request. This is asynchronous.

The thread info can be accessed by ClientData.getThreads(). The notification that the new data is available will be received through AndroidDebugBridge.IClientChangeListener.clientChanged(Client, int) with a changeMask containing the mask CHANGE_THREAD_DATA.


requestThreadStackTrace

public void requestThreadStackTrace(int threadId)
Sends a thread stack trace update request. This is asynchronous.

The thread info can be accessed by ClientData.getThreads() and ThreadInfo.getStackTrace().

The notification that the new data is available will be received through AndroidDebugBridge.IClientChangeListener.clientChanged(Client, int) with a changeMask containing the mask CHANGE_THREAD_STACKTRACE.


setHeapUpdateEnabled

public void setHeapUpdateEnabled(boolean enabled)
Enables or disables the heap update.

If true, any GC will cause the client to send its heap information.

The heap information can be accessed by ClientData.getVmHeapData().

The notification that the new data is available will be received through AndroidDebugBridge.IClientChangeListener.clientChanged(Client, int) with a changeMask containing the value CHANGE_HEAP_DATA.

Parameters:
enabled - the enable flag

isHeapUpdateEnabled

public boolean isHeapUpdateEnabled()
Returns whether the heap update is enabled.

See Also:
setHeapUpdateEnabled(boolean)

requestNativeHeapInformation

public boolean requestNativeHeapInformation()
Sends a native heap update request. this is asynchronous.

The native heap info can be accessed by ClientData.getNativeAllocationList(). The notification that the new data is available will be received through AndroidDebugBridge.IClientChangeListener.clientChanged(Client, int) with a changeMask containing the mask CHANGE_NATIVE_HEAP_DATA.


enableAllocationTracker

public void enableAllocationTracker(boolean enable)
Enables or disables the Allocation tracker for this client.

If enabled, the VM will start tracking allocation informations. A call to requestAllocationDetails() will make the VM sends the information about all the allocations that happened between the enabling and the request.

Parameters:
enable -
See Also:
requestAllocationDetails()

requestAllocationStatus

public void requestAllocationStatus()
Sends a request to the VM to send the enable status of the allocation tracking. This is asynchronous.

The allocation status can be accessed by ClientData.getAllocationStatus(). The notification that the new status is available will be received through AndroidDebugBridge.IClientChangeListener.clientChanged(Client, int) with a changeMask containing the mask CHANGE_HEAP_ALLOCATION_STATUS.


requestAllocationDetails

public void requestAllocationDetails()
Sends a request to the VM to send the information about all the allocations that have happened since the call to enableAllocationTracker(boolean) with enable set to null. This is asynchronous.

The allocation information can be accessed by ClientData.getAllocations(). The notification that the new data is available will be received through AndroidDebugBridge.IClientChangeListener.clientChanged(Client, int) with a changeMask containing the mask CHANGE_HEAP_ALLOCATIONS.


kill

public void kill()
Sends a kill message to the VM.


setAsSelectedClient

public void setAsSelectedClient()
Sets the client to accept debugger connection on the "selected debugger port".

See Also:
AndroidDebugBridge.setSelectedClient(Client), DdmPreferences.setSelectedDebugPort(int)

isSelectedClient

public boolean isSelectedClient()
Returns whether this client is the current selected client, accepting debugger connection on the "selected debugger port".

See Also:
setAsSelectedClient(), AndroidDebugBridge.setSelectedClient(Client), DdmPreferences.setSelectedDebugPort(int)

isValid

public boolean isValid()
Returns whether this Client has a valid connection to the application VM.



Copyright © 2008-2012. All Rights Reserved.