1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 21:06:50 +01:00

Device connection: classify more states as reconnecting

This commit is contained in:
Daniel Dakhno 2024-02-26 13:01:09 +01:00
parent a75b3afc84
commit ee1c3e4db9
2 changed files with 7 additions and 4 deletions

View File

@ -310,7 +310,7 @@ public class GBDevice implements Parcelable {
}
public boolean isConnected() {
return mState.ordinal() >= State.CONNECTED.ordinal();
return mState.equalsOrHigherThan(State.CONNECTED);
}
public boolean isInitializing() {
@ -761,8 +761,8 @@ public class GBDevice implements Parcelable {
return simpleStringId;
}
boolean equalsOrHigherThan(State otherState){
return ordinal() >= otherState.ordinal();
public boolean equalsOrHigherThan(State otherState){
return compareTo(otherState) >= 0;
}
}
}

View File

@ -1145,7 +1145,10 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
}
private boolean isDeviceReconnecting(GBDevice device) {
return deviceStateEquals(device, GBDevice.State.WAITING_FOR_RECONNECT, GBDevice.State.WAITING_FOR_SCAN);
if((device = getDeviceByAddressOrNull(device.getAddress())) != null){
return device.getState().equalsOrHigherThan(GBDevice.State.NOT_CONNECTED);
}
return false;
}
private boolean deviceHasCalendarReceiverRegistered(GBDevice device){