Client

public interface Client

com.android.tradefed.device.server.Client


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().

Summary

Constants

int CHANGE_DEBUGGER_STATUS

Client change bit mask: debugger status change

int CHANGE_HEAP_ALLOCATIONS

Client change bit mask: allocation information updated

int CHANGE_HEAP_ALLOCATION_STATUS

Client change bit mask: allocation information updated

int CHANGE_HEAP_DATA

Client change bit mask: head data updated

int CHANGE_HEAP_MODE

Client change bit mask: heap update flag change

int CHANGE_HPROF

Client change bit mask: hprof data updated

int CHANGE_INFO

Client change bit mask: combination of Client.CHANGE_NAME, CHANGE_DEBUGGER_STATUS, and Client.CHANGE_PORT.

int CHANGE_METHOD_PROFILING_STATUS

Client change bit mask: allocation information updated

int CHANGE_NAME

Client change bit mask: application name change

int CHANGE_NATIVE_HEAP_DATA

Client change bit mask: native heap data updated

int CHANGE_PORT

Client change bit mask: debugger port change

int CHANGE_THREAD_DATA

Client change bit mask: thread data updated

int CHANGE_THREAD_MODE

Client change bit mask: thread update flag change

int CHANGE_THREAD_STACKTRACE

Client change bit mask: thread stack trace updated

int SERVER_PROTOCOL_VERSION

Public methods

abstract void captureView(String viewRoot, String view, DebugViewDumpHandler handler)
abstract void dumpDisplayList(String viewRoot, String view)
abstract void dumpViewHierarchy(String viewRoot, boolean skipChildren, boolean includeProperties, boolean useV2, DebugViewDumpHandler handler)
abstract void enableAllocationTracker(boolean enabled)

Enables or disables the Allocation tracker for this client.

abstract void executeGarbageCollector()

Forces the client to execute its garbage collector.

abstract ClientData getClientData()

Returns the ClientData object containing this client information.

abstract int getDebuggerListenPort()

Returns the debugger port for this client.

abstract IDevice getDevice()

Returns the IDevice on which this Client is running.

abstract boolean isDdmAware()

Returns true if the client VM is DDM-aware.

abstract boolean isDebuggerAttached()

Returns true if a debugger is currently attached to the client.

abstract boolean isValid()

Returns whether this ClientImpl has a valid connection to the application VM.

abstract void kill()

Sends a kill message to the VM.

abstract void listViewRoots(DebugViewDumpHandler replyHandler)
abstract void notifyVmMirrorExited()

Debugger VM mirrors can exit behind DDMLib's back, leading to various race or perma-Client loss conditions.

abstract 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.

abstract void startMethodTracer()
abstract void startSamplingProfiler(int samplingInterval, TimeUnit timeUnit)
abstract void stopMethodTracer()
abstract void stopSamplingProfiler()

Constants

CHANGE_DEBUGGER_STATUS

public static final int CHANGE_DEBUGGER_STATUS

Client change bit mask: debugger status change

Constant Value: 2 (0x00000002)

CHANGE_HEAP_ALLOCATIONS

public static final int CHANGE_HEAP_ALLOCATIONS

Client change bit mask: allocation information updated

Constant Value: 512 (0x00000200)

CHANGE_HEAP_ALLOCATION_STATUS

public static final int CHANGE_HEAP_ALLOCATION_STATUS

Client change bit mask: allocation information updated

Constant Value: 1024 (0x00000400)

CHANGE_HEAP_DATA

public static final int CHANGE_HEAP_DATA

Client change bit mask: head data updated

Constant Value: 64 (0x00000040)

CHANGE_HEAP_MODE

public static final int CHANGE_HEAP_MODE

Client change bit mask: heap update flag change

Constant Value: 32 (0x00000020)

CHANGE_HPROF

public static final int CHANGE_HPROF

Client change bit mask: hprof data updated

Constant Value: 4096 (0x00001000)

CHANGE_INFO

public static final int CHANGE_INFO

Client change bit mask: combination of Client.CHANGE_NAME, CHANGE_DEBUGGER_STATUS, and Client.CHANGE_PORT.

Constant Value: 7 (0x00000007)

CHANGE_METHOD_PROFILING_STATUS

public static final int CHANGE_METHOD_PROFILING_STATUS

Client change bit mask: allocation information updated

Constant Value: 2048 (0x00000800)

CHANGE_NAME

public static final int CHANGE_NAME

Client change bit mask: application name change

Constant Value: 1 (0x00000001)

CHANGE_NATIVE_HEAP_DATA

public static final int CHANGE_NATIVE_HEAP_DATA

Client change bit mask: native heap data updated

Constant Value: 128 (0x00000080)

CHANGE_PORT

public static final int CHANGE_PORT

Client change bit mask: debugger port change

Constant Value: 4 (0x00000004)

CHANGE_THREAD_DATA

public static final int CHANGE_THREAD_DATA

Client change bit mask: thread data updated

Constant Value: 16 (0x00000010)

CHANGE_THREAD_MODE

public static final int CHANGE_THREAD_MODE

Client change bit mask: thread update flag change

Constant Value: 8 (0x00000008)

CHANGE_THREAD_STACKTRACE

public static final int CHANGE_THREAD_STACKTRACE

Client change bit mask: thread stack trace updated

Constant Value: 256 (0x00000100)

SERVER_PROTOCOL_VERSION

public static final int SERVER_PROTOCOL_VERSION

Constant Value: 1 (0x00000001)

Public methods

captureView

public abstract void captureView (String viewRoot, 
                String view, 
                DebugViewDumpHandler handler)

Parameters
viewRoot String

view String

handler DebugViewDumpHandler

dumpDisplayList

public abstract void dumpDisplayList (String viewRoot, 
                String view)

Parameters
viewRoot String

view String

dumpViewHierarchy

public abstract void dumpViewHierarchy (String viewRoot, 
                boolean skipChildren, 
                boolean includeProperties, 
                boolean useV2, 
                DebugViewDumpHandler handler)

Parameters
viewRoot String

skipChildren boolean

includeProperties boolean

useV2 boolean

handler DebugViewDumpHandler

enableAllocationTracker

public abstract void enableAllocationTracker (boolean enabled)

Enables or disables the Allocation tracker for this client.

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

Parameters
enabled boolean

executeGarbageCollector

public abstract void executeGarbageCollector ()

Forces the client to execute its garbage collector.

getClientData

public abstract ClientData getClientData ()

Returns the ClientData object containing this client information.

Returns
ClientData

getDebuggerListenPort

public abstract int getDebuggerListenPort ()

Returns the debugger port for this client.

Returns
int

getDevice

public abstract IDevice getDevice ()

Returns the IDevice on which this Client is running.

Returns
IDevice

isDdmAware

public abstract boolean isDdmAware ()

Returns true if the client VM is DDM-aware.

Calling here is only allowed after the connection has been established.

Returns
boolean

isDebuggerAttached

public abstract boolean isDebuggerAttached ()

Returns true if a debugger is currently attached to the client.

Returns
boolean

isValid

public abstract boolean isValid ()

Returns whether this ClientImpl has a valid connection to the application VM.

Returns
boolean

kill

public abstract void kill ()

Sends a kill message to the VM. This doesn't necessarily work if the VM is in a crashed state.

listViewRoots

public abstract void listViewRoots (DebugViewDumpHandler replyHandler)

Parameters
replyHandler DebugViewDumpHandler

notifyVmMirrorExited

public abstract void notifyVmMirrorExited ()

Debugger VM mirrors can exit behind DDMLib's back, leading to various race or perma-Client loss conditions. We need to notify DDMLib that the debugger currently attached is exiting and killing its VM mirror connection.

requestAllocationDetails

public abstract 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.clientChanged(com.android.tradefed.device.server.ClientImpl, int) with a changeMask containing the mask CHANGE_HEAP_ALLOCATIONS.

startMethodTracer

public abstract void startMethodTracer ()

startSamplingProfiler

public abstract void startSamplingProfiler (int samplingInterval, 
                TimeUnit timeUnit)

Parameters
samplingInterval int

timeUnit TimeUnit

stopMethodTracer

public abstract void stopMethodTracer ()

stopSamplingProfiler

public abstract void stopSamplingProfiler ()