DdmPreferences

public final class DdmPreferences
extends Object

java.lang.Object
   ↳ com.android.ddmlib.DdmPreferences


Preferences for the ddm library.

This class does not handle storing the preferences. It is merely a central point for applications using the ddmlib to override the default values.

Various components of the ddmlib query this class to get their values.

Calls to some set##() methods will update the components using the values right away, while other methods will have no effect once ERROR(/AndroidDebugBridge#init(boolean)) has been called.

Check the documentation of each method.

Summary

Constants

String DEFAULT_ADBHOST_VALUE

boolean DEFAULT_INITIAL_HEAP_UPDATE

Default value for heap update flag upon client connection.

boolean DEFAULT_INITIAL_THREAD_UPDATE

Default value for thread update flag upon client connection.

int DEFAULT_PROFILER_BUFFER_SIZE_MB

Default profiler buffer size (megabytes)

int DEFAULT_TIMEOUT

Default timeout values for adb connection (milliseconds)

boolean DEFAULT_USE_ADBHOST

Default values for the use of the ADBHOST environment variable.

Fields

public static final Log.LogLevel DEFAULT_LOG_LEVEL

Default value for the logcat LogLevel

Public methods

static void enableDdmlibCommandService(boolean enabled)

Enable ddmlib command service allowing for external processes (eg ICEBOX) to issue commands to ddmlib.

static void enableJdwpProxyService(boolean enabled)

Enable jdwp proxy service allowing for multiple client support DDMLIB clients to be used at the same time.

static String getAdbHostValue()

Returns the value of the ADBHOST variable set by the user.

static int getDdmCommandPort()
static boolean getInitialHeapUpdate()

Returns the initial ERROR(/Client) flag for heap updates.

static boolean getInitialThreadUpdate()

Returns the initial ERROR(/Client) flag for thread updates.

static int getJdwpMaxPacketSize()

Packets that are larger than this will throw a buffer overflow exception and disconnect the client.

static int getJdwpProxyPort()
static Log.LogLevel getLogLevel()

Returns the minimum LogLevel being displayed.

static int getProfilerBufferSizeMb()

Returns the profiler buffer size (megabytes).

static int getTimeOut()

Returns the timeout to be used in adb connections (milliseconds).

static boolean getUseAdbHost()

Returns a boolean indicating that the user uses or not the variable ADBHOST.

static boolean isDdmlibCommandServiceEnabled()
static boolean isJdwpProxyEnabled()
static void setAdbHostValue(String adbHostValue)

Sets the value of the ADBHOST variable.

static void setDdmCommandPort(int port)

Set the port used by the ddmlib command service.

static void setInitialHeapUpdate(boolean state)

Sets the initial ERROR(/Client) flag for heap updates.

static void setInitialThreadUpdate(boolean state)

Sets the initial ERROR(/Client) flag for thread updates.

static void setJdwpProxyPort(int port)

Set the port used by the jdwp proxy service.

static void setLogLevel(String value)

Sets the minimum LogLevel to display.

static void setProfilerBufferSizeMb(int bufferSizeMb)

Sets the profiler buffer size value.

static void setTimeOut(int timeOut)

Sets the timeout value for adb connection.

static void setUseAdbHost(boolean useAdbHost)

Sets the value of the boolean indicating that the user uses or not the variable ADBHOST.

static void setsJdwpMaxPacketSize(int size)

Constants

DEFAULT_ADBHOST_VALUE

public static final String DEFAULT_ADBHOST_VALUE

Constant Value: "127.0.0.1"

DEFAULT_INITIAL_HEAP_UPDATE

public static final boolean DEFAULT_INITIAL_HEAP_UPDATE

Default value for heap update flag upon client connection.

Constant Value: false

DEFAULT_INITIAL_THREAD_UPDATE

public static final boolean DEFAULT_INITIAL_THREAD_UPDATE

Default value for thread update flag upon client connection.

Constant Value: false

DEFAULT_PROFILER_BUFFER_SIZE_MB

public static final int DEFAULT_PROFILER_BUFFER_SIZE_MB

Default profiler buffer size (megabytes)

Constant Value: 8 (0x00000008)

DEFAULT_TIMEOUT

public static final int DEFAULT_TIMEOUT

Default timeout values for adb connection (milliseconds)

Constant Value: 5000 (0x00001388)

DEFAULT_USE_ADBHOST

public static final boolean DEFAULT_USE_ADBHOST

Default values for the use of the ADBHOST environment variable.

Constant Value: false

Fields

DEFAULT_LOG_LEVEL

public static final Log.LogLevel DEFAULT_LOG_LEVEL

Default value for the logcat LogLevel

Public methods

enableDdmlibCommandService

public static void enableDdmlibCommandService (boolean enabled)

Enable ddmlib command service allowing for external processes (eg ICEBOX) to issue commands to ddmlib.

Parameters
enabled boolean

enableJdwpProxyService

public static void enableJdwpProxyService (boolean enabled)

Enable jdwp proxy service allowing for multiple client support DDMLIB clients to be used at the same time.

Parameters
enabled boolean

getAdbHostValue

public static String getAdbHostValue ()

Returns the value of the ADBHOST variable set by the user.

Returns
String

getDdmCommandPort

public static int getDdmCommandPort ()

Returns
int

getInitialHeapUpdate

public static boolean getInitialHeapUpdate ()

Returns the initial ERROR(/Client) flag for heap updates.

Returns
boolean

getInitialThreadUpdate

public static boolean getInitialThreadUpdate ()

Returns the initial ERROR(/Client) flag for thread updates.

Returns
boolean

getJdwpMaxPacketSize

public static int getJdwpMaxPacketSize ()

Packets that are larger than this will throw a buffer overflow exception and disconnect the client.

Returns
int

getJdwpProxyPort

public static int getJdwpProxyPort ()

Returns
int

getLogLevel

public static Log.LogLevel getLogLevel ()

Returns the minimum LogLevel being displayed.

Returns
Log.LogLevel

getProfilerBufferSizeMb

public static int getProfilerBufferSizeMb ()

Returns the profiler buffer size (megabytes).

Returns
int

getTimeOut

public static int getTimeOut ()

Returns the timeout to be used in adb connections (milliseconds).

Returns
int

getUseAdbHost

public static boolean getUseAdbHost ()

Returns a boolean indicating that the user uses or not the variable ADBHOST.

Returns
boolean

isDdmlibCommandServiceEnabled

public static boolean isDdmlibCommandServiceEnabled ()

Returns
boolean

isJdwpProxyEnabled

public static boolean isJdwpProxyEnabled ()

Returns
boolean

setAdbHostValue

public static void setAdbHostValue (String adbHostValue)

Sets the value of the ADBHOST variable.

setDdmCommandPort

public static void setDdmCommandPort (int port)

Set the port used by the ddmlib command service. This port is fixed so external services, can send commands to any running instances of ddmlib.

setInitialHeapUpdate

public static void setInitialHeapUpdate (boolean state)

Sets the initial ERROR(/Client) flag for heap updates.

If true, the ERROR(/ClientData) will automatically be updated with the VM heap information whenever a GC happens.

This change takes effect right away, for newly created ERROR(/Client) objects.

Parameters
state boolean

setInitialThreadUpdate

public static void setInitialThreadUpdate (boolean state)

Sets the initial ERROR(/Client) flag for thread updates.

This change takes effect right away, for newly created ERROR(/Client) objects.

Parameters
state boolean

setJdwpProxyPort

public static void setJdwpProxyPort (int port)

Set the port used by the jdwp proxy service. This port should be consistent across all instances of the jdwp proxy service run on a single machine.

setLogLevel

public static void setLogLevel (String value)

Sets the minimum LogLevel to display.

This change takes effect right away.

Parameters
value String

setProfilerBufferSizeMb

public static void setProfilerBufferSizeMb (int bufferSizeMb)

Sets the profiler buffer size value.

Parameters
bufferSizeMb int: the buffer size (megabytes).

setTimeOut

public static void setTimeOut (int timeOut)

Sets the timeout value for adb connection.

This change takes effect for newly created connections only.

Parameters
timeOut int: the timeout value (milliseconds).

setUseAdbHost

public static void setUseAdbHost (boolean useAdbHost)

Sets the value of the boolean indicating that the user uses or not the variable ADBHOST.

Parameters
useAdbHost boolean: true if the user uses ADBHOST

setsJdwpMaxPacketSize

public static void setsJdwpMaxPacketSize (int size)

Parameters
size int