From e9e93423f10a98d32546c6f3b5ddd08fb18fbd2f Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Mon, 6 Jun 2016 23:56:01 +0200 Subject: [PATCH] Don't complain about our own packet types --- src/org/kde/kdeconnect/Device.java | 2 +- src/org/kde/kdeconnect/NetworkPackage.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/org/kde/kdeconnect/Device.java b/src/org/kde/kdeconnect/Device.java index 608b64ca..1346a5d2 100644 --- a/src/org/kde/kdeconnect/Device.java +++ b/src/org/kde/kdeconnect/Device.java @@ -643,7 +643,7 @@ public class Device implements BaseLink.PackageReceiver { hackToMakeRetrocompatiblePacketTypes(np); - if (protocolVersion >= 6 && !supportedOutgoingInterfaces.contains(np.getType())) { + if (protocolVersion >= 6 && !supportedOutgoingInterfaces.contains(np.getType()) && !NetworkPackage.protocolPackageTypes.contains(np.getType())) { Log.e("Device/sendPackage", "Plugin tried to send an unsupported package: " + np.getType()); Log.e("Device/sendPackage", "Supported package types: " + Arrays.toString(supportedOutgoingInterfaces.toArray())); } diff --git a/src/org/kde/kdeconnect/NetworkPackage.java b/src/org/kde/kdeconnect/NetworkPackage.java index f11366b1..3f1cb500 100644 --- a/src/org/kde/kdeconnect/NetworkPackage.java +++ b/src/org/kde/kdeconnect/NetworkPackage.java @@ -33,6 +33,8 @@ import org.kde.kdeconnect.Helpers.DeviceHelper; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; public class NetworkPackage { @@ -41,7 +43,14 @@ public class NetworkPackage { public final static String PACKAGE_TYPE_IDENTITY = "kdeconnect.identity"; public final static String PACKAGE_TYPE_PAIR = "kdeconnect.pair"; public final static String PACKAGE_TYPE_ENCRYPTED = "kdeconnect.encrypted"; - public static final String PACKAGE_TYPE_CAPABILITIES = "kdeconnect.capabilities"; + public final static String PACKAGE_TYPE_CAPABILITIES = "kdeconnect.capabilities"; + + public static Set protocolPackageTypes = new HashSet() {{ + add(PACKAGE_TYPE_IDENTITY); + add(PACKAGE_TYPE_PAIR); + add(PACKAGE_TYPE_ENCRYPTED); + add(PACKAGE_TYPE_CAPABILITIES); + }}; private long mId; String mType;