FileDocCategorySizeDatePackage
DdmHandleAppName.javaAPI DocAndroid 5.1 API2953Thu Mar 12 22:22:10 GMT 2015android.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, int userId)

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

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

        Chunk chunk = new Chunk(CHUNK_APNM, out);
        DdmServer.sendChunk(chunk);
    
public static voidsetAppName(java.lang.String name, int userId)
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, userId);