mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 04:46:51 +01:00
Redmi Smart Band Pro: Fix crash on connection
Requesting alarms crashes the device - #3766
This commit is contained in:
parent
d3957ddf9a
commit
f95d85d7e8
@ -581,4 +581,14 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
public boolean checkDecryptionMac() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the device supports alarms. This differs from {@link #getAlarmSlotCount} since that
|
||||
* returns the number of alarms dynamically after requesting them, but some devices will crash
|
||||
* if we even attempt to request alarms and they do not support them - see
|
||||
* <a href="https://codeberg.org/Freeyourgadget/Gadgetbridge/issues/3766">#3766</a>
|
||||
*/
|
||||
public boolean supportsAlarms() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,14 @@ public class RedmiSmartBandProCoordinator extends XiaomiCoordinator {
|
||||
|
||||
@Override
|
||||
public boolean checkDecryptionMac() {
|
||||
// Sometimes it fails to decrypt with an invalid mac
|
||||
// https://codeberg.org/Freeyourgadget/Gadgetbridge/issues/3766
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsAlarms() {
|
||||
// Crashes when requesting alarms
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,9 @@ public class XiaomiScheduleService extends AbstractXiaomiService {
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
requestAlarms();
|
||||
if (getCoordinator().supportsAlarms()) {
|
||||
requestAlarms();
|
||||
}
|
||||
requestReminders();
|
||||
requestWorldClocks();
|
||||
getSupport().sendCommand("get sleep mode", COMMAND_TYPE, CMD_SLEEP_MODE_GET);
|
||||
|
Loading…
Reference in New Issue
Block a user