From 010c960680a22ac47b762009e2a43e443ef12e09 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Fri, 17 Jun 2016 09:59:31 +0200 Subject: [PATCH] Check for trusted only once --- src/org/kde/kdeconnect/Backends/LanBackend/LanLink.java | 7 ++----- src/org/kde/kdeconnect/Device.java | 7 +++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/org/kde/kdeconnect/Backends/LanBackend/LanLink.java b/src/org/kde/kdeconnect/Backends/LanBackend/LanLink.java index 60a1c104..bcef76b3 100644 --- a/src/org/kde/kdeconnect/Backends/LanBackend/LanLink.java +++ b/src/org/kde/kdeconnect/Backends/LanBackend/LanLink.java @@ -332,14 +332,11 @@ public class LanLink extends BaseLink { //pairing to us, or connections that are already paired. TODO: Keep connections in the process of pairing if (connectionSource == ConnectionStarted.Remotely) { + //Log.e("LinkShouldBeKeptAlive", "because the other end started the connection"); return true; } - SharedPreferences preferences = context.getSharedPreferences("trusted_devices", Context.MODE_PRIVATE); - if (preferences.contains(getDeviceId())) { - return true; //Already paired - } - + //Log.e("LinkShouldBeKeptAlive", "false"); return false; } diff --git a/src/org/kde/kdeconnect/Device.java b/src/org/kde/kdeconnect/Device.java index d15ea327..49698451 100644 --- a/src/org/kde/kdeconnect/Device.java +++ b/src/org/kde/kdeconnect/Device.java @@ -909,6 +909,13 @@ public class Device implements BaseLink.PackageReceiver { } public boolean deviceShouldBeKeptAlive() { + + SharedPreferences preferences = context.getSharedPreferences("trusted_devices", Context.MODE_PRIVATE); + if (preferences.contains(getDeviceId())) { + //Log.e("DeviceShouldBeKeptAlive", "because it's a paired device"); + return true; //Already paired + } + for(BaseLink l : links) { if (l.linkShouldBeKeptAlive()) { return true;