HuaweiSupportProvider: Fix reconnect on AuthFailure

When authentication times out the gadget was slightly out of range.
Since communication was successfull a couple of seconds earlier try to
reconnect instead of just disconnect.

Fixes Huawei watches not automatically reconnecting during normal use.

Signed-off-by: Patrick Rudolph <rudolphpatrick05@gmail.com>
This commit is contained in:
Patrick Rudolph 2025-01-20 17:19:26 +01:00 committed by José Rebelo
parent 7458c582e1
commit 033e263b6b

View File

@ -562,10 +562,11 @@ public class HuaweiSupportProvider {
public void timeout(Request request) {
LOG.error("Authentication timed out");
GB.toast(context, R.string.authentication_failed_negotiation, Toast.LENGTH_LONG, GB.ERROR);
// Disconnect as no communication can succeed after this point
// Reconnect as no communication can succeed after this point
final GBDevice device = getDevice();
if (device != null) {
GBApplication.deviceService(device).disconnect();
device.setState(GBDevice.State.WAITING_FOR_RECONNECT);
device.sendDeviceUpdateIntent(getContext());
}
}