From 7c4a50cf35c42ef9ee305db036b38c501a00835d Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Tue, 20 Aug 2013 09:58:25 +0200 Subject: [PATCH] Added the "add new connection before removing old one" optimization, as was done in Qt. --- .../src/main/java/org/kde/connect/BackgroundService.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/KdeConnect/src/main/java/org/kde/connect/BackgroundService.java b/KdeConnect/src/main/java/org/kde/connect/BackgroundService.java index c2fb9a93..a4ecae96 100644 --- a/KdeConnect/src/main/java/org/kde/connect/BackgroundService.java +++ b/KdeConnect/src/main/java/org/kde/connect/BackgroundService.java @@ -61,8 +61,6 @@ public class BackgroundService extends Service { Log.e("BackgroundService", "Connection accepted!"); - new Throwable().printStackTrace(); - String deviceId = identityPackage.getString("deviceId"); Device device = devices.get(deviceId); @@ -138,6 +136,12 @@ public class BackgroundService extends Service { } } + public void removeConnectionListener(BaseLinkProvider.ConnectionReceiver cr) { + for (BaseLinkProvider a : linkProviders) { + a.removeConnectionReceiver(cr); + } + } + //This will called only once, even if we launch the service intent several times @Override public void onCreate() {