FileDocCategorySizeDatePackage
DdmPreferences.javaAPI DocAndroid 1.5 API5177Wed May 06 22:41:08 BST 2009com.android.ddmlib

DdmPreferences

public final class DdmPreferences extends Object
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 {@link AndroidDebugBridge#init(boolean)} has been called.

Check the documentation of each method.

Fields Summary
public static final boolean
DEFAULT_INITIAL_THREAD_UPDATE
Default value for thread update flag upon client connection.
public static final boolean
DEFAULT_INITIAL_HEAP_UPDATE
Default value for heap update flag upon client connection.
public static final int
DEFAULT_SELECTED_DEBUG_PORT
Default value for the selected client debug port
public static final int
DEFAULT_DEBUG_PORT_BASE
Default value for the debug port base
public static final com.android.ddmlib.Log.LogLevel
DEFAULT_LOG_LEVEL
Default value for the logcat {@link LogLevel}
private static boolean
sThreadUpdate
private static boolean
sInitialHeapUpdate
private static int
sSelectedDebugPort
private static int
sDebugPortBase
private static com.android.ddmlib.Log.LogLevel
sLogLevel
Constructors Summary
private DdmPreferences()
Non accessible constructor.

        // pass, only static methods in the class.
    
Methods Summary
public static intgetDebugPortBase()
Returns the debug port used by the first {@link Client}. Following clients, will use the next port.

        return sDebugPortBase;
    
public static booleangetInitialHeapUpdate()
Returns the initial {@link Client} flag for heap updates.

see
#setInitialHeapUpdate(boolean)

        return sInitialHeapUpdate;
    
public static booleangetInitialThreadUpdate()
Returns the initial {@link Client} flag for thread updates.

see
#setInitialThreadUpdate(boolean)


                    
        
        return sThreadUpdate;
    
public static com.android.ddmlib.Log.LogLevelgetLogLevel()
Returns the minimum {@link LogLevel} being displayed.

        return sLogLevel;
    
public static intgetSelectedDebugPort()
Returns the debug port used by the selected {@link Client}.

        return sSelectedDebugPort;
    
public static voidsetDebugPortBase(int port)
Sets the debug port used by the first {@link Client}.

Once a port is used, the next Client will use port + 1. Quitting applications will release their debug port, and new clients will be able to reuse them.

This must be called before {@link AndroidDebugBridge#init(boolean)}.

        sDebugPortBase = port;
    
public static voidsetInitialHeapUpdate(boolean state)
Sets the initial {@link Client} flag for heap updates.

If true, the {@link ClientData} will automatically be updated with the VM heap information whenever a GC happens.

This change takes effect right away, for newly created {@link Client} objects.

        sInitialHeapUpdate = state;
    
public static voidsetInitialThreadUpdate(boolean state)
Sets the initial {@link Client} flag for thread updates.

This change takes effect right away, for newly created {@link Client} objects.

        sThreadUpdate = state;
    
public static voidsetLogLevel(java.lang.String value)
Sets the minimum {@link LogLevel} to display.

This change takes effect right away.

        sLogLevel = LogLevel.getByString(value);

        Log.setLevel(sLogLevel);
    
public static voidsetSelectedDebugPort(int port)
Sets the debug port used by the selected {@link Client}.

This change takes effect right away.

param
port the new port to use.

        sSelectedDebugPort = port;

        MonitorThread monitorThread = MonitorThread.getInstance();
        if (monitorThread != null) {
            monitorThread.setDebugSelectedPort(port);
        }