Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9af35449 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Handle the case where window position comes before view map"

parents 92b6ab45 8439c6dc
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -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);