DeviceCommunicationService: Notify device connections right away

As noted in #3676, having a lot of bluetooth classic devices might make
the connection take some time, which would only send all the updates at
the end.

Send the updates right away for each device.
This commit is contained in:
José Rebelo 2024-04-02 22:04:10 +01:00
parent 7fb0d19374
commit 9b285f16bf
1 changed files with 1 additions and 7 deletions

View File

@ -585,8 +585,6 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
return;
}
final List<DeviceStruct> shouldGetNotifiedOfUpdate = new ArrayList<>();
for (GBDevice gbDevice : gbDevs) {
if (!gbDevice.getDeviceCoordinator().isConnectable()) {
// we cannot connect to beacons, skip this device
@ -631,8 +629,6 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
}
}
shouldGetNotifiedOfUpdate.add(registeredStruct);
try {
final DeviceSupport deviceSupport = mFactory.createDeviceSupport(gbDevice);
@ -652,10 +648,8 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
} catch (Exception e) {
GB.toast(this, getString(R.string.cannot_connect, e.getMessage()), Toast.LENGTH_SHORT, GB.ERROR, e);
}
}
for (final DeviceStruct struct : shouldGetNotifiedOfUpdate) {
struct.getDevice().sendDeviceUpdateIntent(this);
registeredStruct.getDevice().sendDeviceUpdateIntent(this);
}
}