2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-22 09:58:08 +00:00

Start the timer before the packet has been sent

Fixes the loopback provider starting the timer after the paring is
already done, causing it to unpair after 30 seconds.
This commit is contained in:
Albert Vaca Cintora 2023-06-02 19:43:46 +02:00
parent e9732d009a
commit 5a620b4a7a

View File

@ -121,19 +121,19 @@ public class PairingHandler {
mPairState = PairState.Requested; mPairState = PairState.Requested;
mPairingTimer = new Timer();
mPairingTimer.schedule(new TimerTask() {
@Override
public void run() {
Log.w("PairingHandler","Unpairing (timeout after receiving pair request)");
mPairState = PairState.NotPaired;
mCallback.pairingFailed(mDevice.getContext().getString(R.string.error_timed_out));
}
}, 30*1000); //Time to wait for the other to accept
Device.SendPacketStatusCallback statusCallback = new Device.SendPacketStatusCallback() { Device.SendPacketStatusCallback statusCallback = new Device.SendPacketStatusCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() { }
mPairingTimer = new Timer();
mPairingTimer.schedule(new TimerTask() {
@Override
public void run() {
Log.w("PairingHandler","Unpairing (timeout after receiving pair request)");
mPairState = PairState.NotPaired;
mCallback.pairingFailed(mDevice.getContext().getString(R.string.error_timed_out));
}
}, 30*1000); //Time to wait for the other to accept
}
@Override @Override
public void onFailure(Throwable e) { public void onFailure(Throwable e) {