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

Commit 8439c6dc authored by Manu Cornet's avatar Manu Cornet
Browse files

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
parent e94cc880
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);