FileDocCategorySizeDatePackage
DdmHandleNativeHeap.javaAPI DocAndroid 5.1 API2652Thu Mar 12 22:22:10 GMT 2015android.ddm

DdmHandleNativeHeap

public class DdmHandleNativeHeap extends org.apache.harmony.dalvik.ddmc.ChunkHandler
Handle thread-related traffic.

Fields Summary
public static final int
CHUNK_NHGT
private static DdmHandleNativeHeap
mInstance
Constructors Summary
private DdmHandleNativeHeap()



    /* 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.

private native byte[]getLeakInfo()

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

        Log.i("ddm-nativeheap", "Handling " + name(request.type) + " chunk");
        int type = request.type;

        if (type == CHUNK_NHGT) {
            return handleNHGT(request);
        } else {
            throw new RuntimeException("Unknown packet "
                + ChunkHandler.name(type));
        }
    
private org.apache.harmony.dalvik.ddmc.ChunkhandleNHGT(org.apache.harmony.dalvik.ddmc.Chunk request)

        //ByteBuffer in = wrapChunk(request);

        byte[] data = getLeakInfo();

        if (data != null) {
            // wrap & return
            Log.i("ddm-nativeheap", "Sending " + data.length + " bytes");
            return new Chunk(ChunkHandler.type("NHGT"), data, 0, data.length);
        } else {
            // failed, return a failure error code and message
            return createFailChunk(1, "Something went wrong");
        }
    
public static voidregister()
Register for the messages we're interested in.

        DdmServer.registerHandler(CHUNK_NHGT, mInstance);