mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-25 11:26:47 +01:00
Xiaomi: Handle find phone messages without system
properly
After find phone is stopped, watch sends a `Command` message back without `system` set, and because of missing hasSystem() check, we'd wrongly go to condition that sets findPhoneEvent.event to START.
This commit is contained in:
parent
cb66cd742a
commit
0ca35ad935
@ -159,13 +159,15 @@ public class XiaomiSystemService extends AbstractXiaomiService implements Xiaomi
|
|||||||
return;
|
return;
|
||||||
case CMD_FIND_PHONE:
|
case CMD_FIND_PHONE:
|
||||||
LOG.debug("Got find phone: {}", cmd.getSystem().getFindDevice());
|
LOG.debug("Got find phone: {}", cmd.getSystem().getFindDevice());
|
||||||
final GBDeviceEventFindPhone findPhoneEvent = new GBDeviceEventFindPhone();
|
if (cmd.hasSystem()) {
|
||||||
if (cmd.getSystem().getFindDevice() == 0) {
|
final GBDeviceEventFindPhone findPhoneEvent = new GBDeviceEventFindPhone();
|
||||||
findPhoneEvent.event = GBDeviceEventFindPhone.Event.START;
|
if (cmd.getSystem().getFindDevice() == 0) {
|
||||||
} else {
|
findPhoneEvent.event = GBDeviceEventFindPhone.Event.START;
|
||||||
findPhoneEvent.event = GBDeviceEventFindPhone.Event.STOP;
|
} else {
|
||||||
|
findPhoneEvent.event = GBDeviceEventFindPhone.Event.STOP;
|
||||||
|
}
|
||||||
|
getSupport().evaluateGBDeviceEvent(findPhoneEvent);
|
||||||
}
|
}
|
||||||
getSupport().evaluateGBDeviceEvent(findPhoneEvent);
|
|
||||||
return;
|
return;
|
||||||
case CMD_DISPLAY_ITEMS_GET:
|
case CMD_DISPLAY_ITEMS_GET:
|
||||||
handleDisplayItems(cmd.getSystem().getDisplayItems());
|
handleDisplayItems(cmd.getSystem().getDisplayItems());
|
||||||
|
Loading…
Reference in New Issue
Block a user