mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-13 19:27:33 +01:00
Pebble: fix nasty crash when appmessage id is > 127
This is a regression since Gadgetbridge 0.22.0 Potentially fixes the following: - #868 - #876 - #884 NOTE: Java has no unisgned, java has no unsigned, java has no unsigned. Java has no unisgned, java has no unsigned, java has no unsigned. Java has no unisgned, java has no unsigned, java has no unsigned.
This commit is contained in:
parent
97fda2434d
commit
7ffcc44378
@ -1986,7 +1986,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
idLookup[last_id] = ext_id;
|
idLookup[last_id & 0xff] = ext_id;
|
||||||
|
|
||||||
return buf.array();
|
return buf.array();
|
||||||
}
|
}
|
||||||
@ -2633,14 +2633,14 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
LOG.info("got APPLICATIONMESSAGE/LAUNCHER (EP " + endpoint + ") NACK");
|
LOG.info("got APPLICATIONMESSAGE/LAUNCHER (EP " + endpoint + ") NACK");
|
||||||
}
|
}
|
||||||
GBDeviceEventAppMessage evtAppMessage = null;
|
GBDeviceEventAppMessage evtAppMessage = null;
|
||||||
if (endpoint == ENDPOINT_APPLICATIONMESSAGE && idLookup[last_id] != null) {
|
if (endpoint == ENDPOINT_APPLICATIONMESSAGE && idLookup[last_id & 0xff] != null) {
|
||||||
evtAppMessage = new GBDeviceEventAppMessage();
|
evtAppMessage = new GBDeviceEventAppMessage();
|
||||||
if (pebbleCmd == APPLICATIONMESSAGE_ACK) {
|
if (pebbleCmd == APPLICATIONMESSAGE_ACK) {
|
||||||
evtAppMessage.type = GBDeviceEventAppMessage.TYPE_ACK;
|
evtAppMessage.type = GBDeviceEventAppMessage.TYPE_ACK;
|
||||||
} else {
|
} else {
|
||||||
evtAppMessage.type = GBDeviceEventAppMessage.TYPE_NACK;
|
evtAppMessage.type = GBDeviceEventAppMessage.TYPE_NACK;
|
||||||
}
|
}
|
||||||
evtAppMessage.id = idLookup[last_id];
|
evtAppMessage.id = idLookup[last_id & 0xff];
|
||||||
evtAppMessage.appUUID = currentRunningApp;
|
evtAppMessage.appUUID = currentRunningApp;
|
||||||
}
|
}
|
||||||
devEvts = new GBDeviceEvent[]{evtAppMessage};
|
devEvts = new GBDeviceEvent[]{evtAppMessage};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user