1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-09 11:47:04 +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:
LuK1337 2023-12-19 00:15:53 +01:00 committed by José Rebelo
parent cb66cd742a
commit 0ca35ad935

View File

@ -159,6 +159,7 @@ public class XiaomiSystemService extends AbstractXiaomiService implements Xiaomi
return;
case CMD_FIND_PHONE:
LOG.debug("Got find phone: {}", cmd.getSystem().getFindDevice());
if (cmd.hasSystem()) {
final GBDeviceEventFindPhone findPhoneEvent = new GBDeviceEventFindPhone();
if (cmd.getSystem().getFindDevice() == 0) {
findPhoneEvent.event = GBDeviceEventFindPhone.Event.START;
@ -166,6 +167,7 @@ public class XiaomiSystemService extends AbstractXiaomiService implements Xiaomi
findPhoneEvent.event = GBDeviceEventFindPhone.Event.STOP;
}
getSupport().evaluateGBDeviceEvent(findPhoneEvent);
}
return;
case CMD_DISPLAY_ITEMS_GET:
handleDisplayItems(cmd.getSystem().getDisplayItems());