am bff124f1: Merge "Adds support for Theme dumping via DDM." into lmp-dev

* commit 'bff124f1e86a6cfc1710d41bedd060b7378de06b':
  Adds support for Theme dumping via DDM.
This commit is contained in:
Jon Miranda
2014-09-18 20:24:00 +00:00
committed by Android Git Automerger

View File

@@ -56,6 +56,9 @@ public class DdmHandleViewDebug extends ChunkHandler {
/** Capture View Layers. */
private static final int VURT_CAPTURE_LAYERS = 2;
/** Dump View Theme. */
private static final int VURT_DUMP_THEME = 3;
/**
* Generic View Operation, first parameter in the packet should be one of the
* VUOP_* constants below.
@@ -131,6 +134,8 @@ public class DdmHandleViewDebug extends ChunkHandler {
return dumpHierarchy(rootView, in);
else if (op == VURT_CAPTURE_LAYERS)
return captureLayers(rootView);
else if (op == VURT_DUMP_THEME)
return dumpTheme(rootView);
else
return createFailChunk(ERR_INVALID_OP, "Unknown view root operation: " + op);
}
@@ -258,6 +263,22 @@ public class DdmHandleViewDebug extends ChunkHandler {
return new Chunk(CHUNK_VURT, data, 0, data.length);
}
/**
* Returns the Theme dump of the provided view.
*/
private Chunk dumpTheme(View rootView) {
ByteArrayOutputStream b = new ByteArrayOutputStream(1024);
try {
ViewDebug.dumpTheme(rootView, b);
} catch (IOException e) {
return createFailChunk(1, "Unexpected error while dumping the theme: "
+ e.getMessage());
}
byte[] data = b.toByteArray();
return new Chunk(CHUNK_VURT, data, 0, data.length);
}
private Chunk captureView(View rootView, View targetView) {
ByteArrayOutputStream b = new ByteArrayOutputStream(1024);
try {