mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-09 03:37:03 +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() {
|
public boolean checkDecryptionMac() {
|
||||||
return true;
|
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
|
@Override
|
||||||
public boolean checkDecryptionMac() {
|
public boolean checkDecryptionMac() {
|
||||||
|
// Sometimes it fails to decrypt with an invalid mac
|
||||||
// https://codeberg.org/Freeyourgadget/Gadgetbridge/issues/3766
|
// https://codeberg.org/Freeyourgadget/Gadgetbridge/issues/3766
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsAlarms() {
|
||||||
|
// Crashes when requesting alarms
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,9 @@ public class XiaomiScheduleService extends AbstractXiaomiService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
if (getCoordinator().supportsAlarms()) {
|
||||||
requestAlarms();
|
requestAlarms();
|
||||||
|
}
|
||||||
requestReminders();
|
requestReminders();
|
||||||
requestWorldClocks();
|
requestWorldClocks();
|
||||||
getSupport().sendCommand("get sleep mode", COMMAND_TYPE, CMD_SLEEP_MODE_GET);
|
getSupport().sendCommand("get sleep mode", COMMAND_TYPE, CMD_SLEEP_MODE_GET);
|
||||||
|
Loading…
Reference in New Issue
Block a user