diff options
author | Manu Cornet <manucornet@google.com> | 2016-09-16 17:02:44 -0700 |
---|---|---|
committer | Manu Cornet <manucornet@google.com> | 2016-09-16 17:06:24 -0700 |
commit | 8439c6dcb2963c8a0e17ef00fc2a9592b3a066d0 (patch) | |
tree | fe4e36022becd38b03402465d7c08b362b136ea0 | |
parent | e94cc880c89b2b36a99b7d707951b373d5186f34 (diff) |
Handle the case where window position comes before view map
Test: Tested this change with a device with http://go/ag/1451804 to
make sure the new protocol was understood.
Change-Id: I9c42cfeb27951ae66a77386d0644d84c230a4923
-rw-r--r-- | tests/HierarchyViewerTest/src/com/android/test/hierarchyviewer/ViewDumpParser.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/HierarchyViewerTest/src/com/android/test/hierarchyviewer/ViewDumpParser.java b/tests/HierarchyViewerTest/src/com/android/test/hierarchyviewer/ViewDumpParser.java index 0111bc631650..2ad0da98c409 100644 --- a/tests/HierarchyViewerTest/src/com/android/test/hierarchyviewer/ViewDumpParser.java +++ b/tests/HierarchyViewerTest/src/com/android/test/hierarchyviewer/ViewDumpParser.java @@ -15,6 +15,17 @@ public class ViewDumpParser { Decoder d = new Decoder(ByteBuffer.wrap(data)); mViews = new ArrayList<>(100); + + boolean dataIncludesWindowPosition = (data[0] == 'S'); + Short windowLeftKey = null, windowTopKey = null; + Integer windowLeftValue = null, windowTopValue = null; + if (dataIncludesWindowPosition) { + windowLeftKey = (Short) d.readObject(); + windowLeftValue = (Integer) d.readObject(); + windowTopKey = (Short) d.readObject(); + windowTopValue = (Integer) d.readObject(); + } + while (d.hasRemaining()) { Object o = d.readObject(); if (o instanceof Map) { @@ -27,6 +38,11 @@ public class ViewDumpParser { return; } + if (dataIncludesWindowPosition) { + mViews.get(0).put(windowLeftKey, windowLeftValue); + mViews.get(0).put(windowTopKey, windowTopValue); + } + // the last one is the property map Map<Short,Object> idMap = mViews.remove(mViews.size() - 1); mIds = reverse(idMap); |