2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 13:47:41 +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 b14df9d09c
commit 8c1fe000f6

View File

@@ -120,19 +120,19 @@ public class PairingHandler {
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() {
@Override
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
}
public void onSuccess() { }
@Override
public void onFailure(Throwable e) {