summaryrefslogtreecommitdiffstats
path: root/core/java/android/ddm
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2014-09-15 17:48:10 -0700
committerJon Miranda <jonmiranda@google.com>2014-09-18 11:29:08 -0700
commite82a4eeb40090f15054e2c76c0cea84b198a2b61 (patch)
tree42df581b9fa2bcfbd2d1d789a02ec8a4fe868a18 /core/java/android/ddm
parent7c744bdbf35aedbdde3a5ff9f2374e91f16f3641 (diff)
downloadframeworks_base-e82a4eeb40090f15054e2c76c0cea84b198a2b61.zip
frameworks_base-e82a4eeb40090f15054e2c76c0cea84b198a2b61.tar.gz
frameworks_base-e82a4eeb40090f15054e2c76c0cea84b198a2b61.tar.bz2
Adds support for Theme dumping via DDM.
Bug: 17515415 Change-Id: Ice145a4b452177e36345cf2e071377bb7b3feeb3
Diffstat (limited to 'core/java/android/ddm')
-rw-r--r--core/java/android/ddm/DdmHandleViewDebug.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/java/android/ddm/DdmHandleViewDebug.java b/core/java/android/ddm/DdmHandleViewDebug.java
index ce83796..3a36b0a 100644
--- a/core/java/android/ddm/DdmHandleViewDebug.java
+++ b/core/java/android/ddm/DdmHandleViewDebug.java
@@ -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 {