FileDocCategorySizeDatePackage
DdmHandleAppName.javaAPI DocAndroid 1.5 API2788Wed May 06 22:41:54 BST 2009android.ddm

DdmHandleAppName

public class DdmHandleAppName extends org.apache.harmony.dalvik.ddmc.ChunkHandler
Track our app name. We don't (currently) handle any inbound packets.

Fields Summary
public static final int
CHUNK_APNM
private static volatile String
mAppName
private static DdmHandleAppName
mInstance
Constructors Summary
private DdmHandleAppName()



    /* singleton, do not instantiate */
      
Methods Summary
public voidconnected()
Called when the DDM server connects. The handler is allowed to send messages to the server.

public voiddisconnected()
Called when the DDM server disconnects. Can be used to disable periodic transmissions or clean up saved state.

public static java.lang.StringgetAppName()

        return mAppName;
    
public org.apache.harmony.dalvik.ddmc.ChunkhandleChunk(org.apache.harmony.dalvik.ddmc.Chunk request)
Handle a chunk of data.

        return null;
    
public static voidregister()
Register for the messages we're interested in.

private static voidsendAPNM(java.lang.String appName)

        if (Config.LOGV)
            Log.v("ddm", "Sending app name");

        ByteBuffer out = ByteBuffer.allocate(4 + appName.length()*2);
        out.order(ChunkHandler.CHUNK_ORDER);
        out.putInt(appName.length());
        putString(out, appName);

        Chunk chunk = new Chunk(CHUNK_APNM, out);
        DdmServer.sendChunk(chunk);
    
public static voidsetAppName(java.lang.String name)
Set the application name. Called when we get named, which may be before or after DDMS connects. For the latter we need to send up an APNM message.

        if (name == null || name.length() == 0)
            return;

        mAppName = name;

        // if DDMS is already connected, send the app name up
        sendAPNM(name);