2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 05:37:43 +00:00

Check for trusted only once

This commit is contained in:
Albert Vaca 2016-06-17 09:59:31 +02:00
parent 49d4383828
commit 010c960680
2 changed files with 9 additions and 5 deletions

View File

@ -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 //pairing to us, or connections that are already paired. TODO: Keep connections in the process of pairing
if (connectionSource == ConnectionStarted.Remotely) { if (connectionSource == ConnectionStarted.Remotely) {
//Log.e("LinkShouldBeKeptAlive", "because the other end started the connection");
return true; return true;
} }
SharedPreferences preferences = context.getSharedPreferences("trusted_devices", Context.MODE_PRIVATE); //Log.e("LinkShouldBeKeptAlive", "false");
if (preferences.contains(getDeviceId())) {
return true; //Already paired
}
return false; return false;
} }

View File

@ -909,6 +909,13 @@ public class Device implements BaseLink.PackageReceiver {
} }
public boolean deviceShouldBeKeptAlive() { 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) { for(BaseLink l : links) {
if (l.linkShouldBeKeptAlive()) { if (l.linkShouldBeKeptAlive()) {
return true; return true;